I'm in the process of building a client/server based game for a project(feeling quite out my depth). I've been using TCPclient and a multi-threaded socket server. Everything is working fine at the moment but I have been using StreamReader and StreamWriter to communicate between both client and server.
I keep seeing examples like this for recieving data:
byte[] data = new byte[1024];
int recv = sock.ReceiveFrom(data, ref ep);
string stringData = Encoding.ASCII.GetString(data, 0, recv);
and this for sending:
byte[] data = Encoding.ASCII.GetBytes("This is a test message");
server.SendTo(data, iep);
I was wondering what are the benefits of using this over streamReader? Would using this also be buffering?
Thanks in advance.