Link to home
Start Free TrialLog in
Avatar of Dan Flood
Dan Flood

asked on

C# TCP Communication Troubles

I have a basic understanding of threading and tcpclient however I am not certain how to best handle this:

Client Application must connect to a server and give it a login notice.

Client application  sell send updates to the server on an as needed basis

server will ask client to confirm that it's online and working ok every 5 seconds.

So do i use a tcpclient & tcp listener?  it all happens on the same port... confused....
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dan Flood
Dan Flood


Thanks, I understand a bit better now.  So I could create a tcpclient to connect to the server at the given port, and then create a tcplistener on the port that is returned?
you don't need a tcplistener at client side, listening is just for connecting. The connected socket already can read and write into it.
Avatar of Mike Tomlinson
Are you writing both the client and the server?

Client Side = TcpClient for both send and receive to server
Server Side = TcpListener to listen / TcpClient after a connection is made