인프런 커뮤니티 질문&답변

mhyim님의 프로필 이미지

작성한 질문수

[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part4: 게임 서버

SendBuffer

byte[] -> ArraySegment 변환 중 생략 된 부분

해결된 질문

23.12.17 17:24 작성

·

313

·

수정됨

2

더미클라와 서버의 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);

}

}

답변

답변을 기다리고 있는 질문이에요
첫번째 답변을 남겨보세요!
mhyim님의 프로필 이미지

작성한 질문수

질문하기