Hi i found this site and this guy tries to teach you how to make a chat program. Well i just copied his code in and... th program worked. I can send a message to the server and it sends it back just fine. But i can only send a message once. If i try to send another message i get an error and it says this "A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll" then it "No connection could be made because the target machine actively refused it 127.0.0.1:500"

here is the link to the tutorial and code
http://ondotnet.com/pub/a/dotnet/2003/07/07/netstreams.html

tcpclient.Close() <<< thats the reason
this code is made for demonstration only and closes after first receive.
You have to add some eventhandlers for client connect, receiving and so and only close the tcpclient if you really want it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.