Click here to Skip to main content
16,005,491 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using Tcplistener to listen on a port for requests. When the requests come in from the client I want to know the client ip making the request. the problem is : the server and all client take the same Ip
so I decided to send massage from server to client by port ... I search a lot on google But I did not knew how I can send message from server to client using the port ? so can any body help me ?

What I have tried:

my try in my quetion above ... I search alot but did not knew How I can send message from server to client using the port
Posted
Updated 15-Nov-16 19:36pm
v2
Comments
F-ES Sitecore 15-Nov-16 10:06am    
You're running the client and server on the same machine? Of course they are going to have the same address!
Richard MacCutchan 15-Nov-16 10:25am    
When the server receives a message it gets a connected socket from the client, so you just reply on that socket. Google for "TCP client server" for lots of samples.
Richard MacCutchan 16-Nov-16 3:52am    
See my suggestion above.

1 solution

The way it works is both client and server have an IP address. If both run on the same machine it will likely be the same. The 'service' is defined by the port number. 80 for HTTP, 21 for SMTP etc.

You have to have both for TCP communication, and you do - you're using port 8080 (which is a common choice for an HTTP proxy).

That's all you have, IPAddress - Who, Port - Doing What. If that information is not enough then you'll have to role your own above the TCP stack.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900