![]() Int byte_count = ns.Read(receivedBytes, 0, receivedBytes.Length) Īrray.Copy(receivedBytes, formated, byte_count) Ĭonsole.WriteLine("disconnect from server!!") IPAddress ip = IPAddress.Parse("127.0.0.1") īyte buffer = (s) I created this box, so I can pass 2 args for the Thread.start(). Public static void broadcast(Dictionary conexoes, string data)īyte buffer = (data) ![]() ![]() handle the null characteres in the byte arrayĪrray.Copy(buffer, formated, byte_count) Int byte_count = stream.Read(buffer, 0, buffer.Length) NetworkStream stream = box.c.GetStream() Public static void handle_clients(object o) TcpClient client = ServerSocket.AcceptTcpClient() Ĭonsole.WriteLine("Someone connected!!") TcpListener ServerSocket = new TcpListener(IPAddress.Any, 5000) When there is 1 client connected, it works as expected, the problem is occurred when there is more than 1 client connected.ĭictionary list_clients = new Dictionary () So, I decided to make a TCP chat, the basic idea is that A client send data to the server, then the server broadcast it for all the clients online (in this case all the clients are in a dictionary).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |