For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > March 2005 > how socket communication happens on same port?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how socket communication happens on same port?
rahul8143

2005-03-31, 8:57 am

Hello all,
If i run tcpserver on pc1 with port 9200 ,tcpclient on pc2 with
9200 and same in reverse tcpclient on pc1 ,tcpserver on pc2 on 9200.
How can both programs work on same port without problem?
why it not require to have different port to read/write to sockets
from pc1 to pc2 and pc2 to pc1?
regards,
rahul.
Ulrich Hobelmann

2005-03-31, 8:57 pm

rahul8143 wrote:
> Hello all,
> If i run tcpserver on pc1 with port 9200 ,tcpclient on pc2 with
> 9200 and same in reverse tcpclient on pc1 ,tcpserver on pc2 on 9200.
> How can both programs work on same port without problem?
> why it not require to have different port to read/write to sockets
> from pc1 to pc2 and pc2 to pc1?
> regards,
> rahul.


What are you talking about??

You open a connection to a host at a port, like pc2:9200 or
pc1:9200. There's no need for different ports. The whole WWW
runs on port 80!

The clients don't run on port 9200. Your client chooses a port to
connect to, but that doesn't have anything to do with that port on
*your* machine.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com