-
카테고리
-
세부 분야
게임 프로그래밍
-
해결 여부
해결됨
byte[] -> ArraySegment 변환 중 생략 된 부분
23.12.17 17:24 작성 23.12.19 06:39 수정 조회수 215
1
더미클라와 서버의 Program.cs에서
byte가 arraysegment 부분으로 변환되는게 생략되었습니다.
어려운 작업은 아니지만, 뒤에 듣는사람 참고하라고 올립니다.
아닌가.. 내가 잘못한 부분이 있었네
public override void OnConnected(EndPoint endPoint)
{
Console.WriteLine($"OnConnected bytes : {endPoint}");
byte[] tempBuff = Encoding.UTF8.GetBytes("Welcome to MMORPG Server!");
ArraySegment<byte> sendBuff = new ArraySegment<byte>(tempBuff);
Send(sendBuff);
Thread.Sleep(1000);
Disconnect();
}
public override void OnConnected(EndPoint endPoint)
{
Console.WriteLine($"OnConnected bytes : {endPoint}");
//데이터를 보낸다
for (int i = 0; i < 5; i++)
{
byte[] tempBuff = Encoding.UTF8.GetBytes($"Hello World {i}");
ArraySegment<byte> sendBuff = new ArraySegment<byte>(tempBuff);
Send(sendBuff);
}
}
답변을 작성해보세요.
답변 0