That's how server works. But my understanding of what he is saying is that 2 independent client process can use the same TCP port, which I don't think possible.
-dennis2(Dennis);
2001-7-29(#148832@0)
That is not possible. How did you know they are using the same IP/port? Post your result of "netstat -a -n -f inet" please. Also, which OS are you using?
-dennis2(Dennis);
2001-7-29(#148841@0)
You can define in your program doesn't mean you can run it. Please post your result of "netstat -a -n". I will believe you until I see it.
-dennis2(Dennis);
2001-7-29(#148845@0)
well...it's quite normal...On a port, there can be mutiple in-bound connection while there can be only one out-bound connection...
-pazu(InTheSky);
2001-8-2(#153878@0)
I'm no Gao Ren, in fact, I'm a freshman, a stubborn one. :-) Anyway, I have to go to sleep now. Nice chatting with you guys.
-dennis2(Dennis);
2001-7-29(#148856@0)
等一等,还是有问题,见上贴
-guest:;
2001-7-29(#148857@0)
OK, those entries with ESTABLISHED keyword indicate established connections. In those entries, c/s ports cannot be the same, which is indicated in your result.
-dennis2(Dennis);
2001-7-29(#148858@0)
But client has to use a port, right?
-dennis2(Dennis);
2001-7-29(#148851@0)
used for find the correct server process. the port = a server process
-huofu(huofu);
2001-7-29(#148852@0)
From unix-socket-faq:
-dennis2(Dennis);
2001-7-29{211}(#148853@0)
It has been pointed out that "A socket is a 5 tuple (proto, local addr, local port, remote addr, remote port). SO_REUSEADDR just says that you can reuse local addresses. The 5 tuple still must be unique!"
呵呵,port只对SERVER端process而言,client端PROCESS 建立SOCKET后,不用BIND(),用WELL KNOWN PORT 建立CONNECTION 就可以READ()AND WRITE()了
-huofu(huofu);
2001-7-29(#148849@0)
agree with u
-trafford(老特,上火中...);
2001-8-2(#153272@0)
无论是JAVA还是C的SOCKET编程,SERVER端都是以不变应万变,即在WELL KNOWN PORT ACCEPT 来自任何CLIENT端的CONNECTION请求,随即在子线程中用新分配的唯一新SOCKET与唯一对应的CLIENT通信,这是个原则,需要编程实现
-huofu(huofu);
2001-7-29(#148824@0)
after I saw all the response I know how u guys can't find a good job. so stupid.
the socket address is composed of (serverIP,server Port,client Ip,Client Port), so how could u got a mess?
-frankwoo(frank);
2001-8-22(#176480@0)
No problem.
-mcdonald(麦当劳);
2001-8-22{145}(#176492@0)
whenever the server reveive a request, it will throw a new thread or process to handle it.
eg, you can ping a server from one station N times.