Hello Werner,

You have to make a little protocol for that. B listens on a know
IP:Port. A connect to B and tells B the port he will listen on in the
protocol. Then later B can connect to A because he know the listening
port by then.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Friday, March 31, 2006, 11:47, Werner wrote:



> On a second session, the server turns client, and client turns server:
> client(ComputerA) port 2000 -> connect server(ComputerB) at port 2500. Close
> connection ( ComputerB knows the adress, and gets the clients actual port,
> in someway)
> then
> client(ComputerB) port 2500 -> connect server(ComputerA) at port 2000. Close
> connection. (This works fine when the ComputerA has a fix port adress)

> The things is, when a new client access the server at an ipaddress, this
> server( wich will be a clientSocket at that moment) needs to know the actual
> port number to connect the client back (wich will be a serverSocket at that
> moment). On a later moment.
> So each computer has a client and serverSocket running.



>>
>> > The client has port 2000. When the client change his port to 2001, is
> there
>> > a way, when connecting to the server to retreive the clients actual port
>> > address?. I must know this port because I need to contact this client
> back
>> > on an other WSocket. Ofcourse it wil work fine if the client don't
> change
>> > his port number.
>>
>> I dont understeand the question. Can you explain again please ? Do you
>> mean with 'Client' the 'Datasocket' of the server where you are
>> connected with ? If so then this socket is released when tcp session is
>> closed, but please explain again, it is not clear to me what you wants.
>>
>> ---
>> Rgds, Wilfried [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> http://www.mestdagh.biz
>>
>> Friday, March 31, 2006, 10:46, Werner wrote:
>>
>> > Thank Wilfried, thats explains a lot.
>>
>> > When the server listen to port 2500, and the socket port start
> increasing
>> > from 2000. Do I get in trouble when it comes finaly to port
> 2489,2499..2500
>> > the same port where the server is listening, or is this handled
> automaticaly
>> > by the socket that the increasing port will never be the listening
> server
>> > port ?
>> > To explain more: my program get every 10 seconds an incoming client, get
> the
>> > command, then close again. And I see the port increasing fast, what
> about a
>> > limit ? can I reset the portnumber?, it's a black hole for me.
>>
>> > The client has port 2000. When the client change his port to 2001, is
> there
>> > a way, when connecting to the server to retreive the clients actual port
>> > address?. I must know this port because I need to contact this client
> back
>> > on an other WSocket. Ofcourse it wil work fine if the client don't
> change
>> > his port number.
>>
>> > Thanks a lot
>> > Werner
>>
>>
>> > ----- Oorspronkelijk bericht ----- 
>> > Van: "Wilfried Mestdagh" <[EMAIL PROTECTED]>
>> > Aan: "ICS support mailing" <twsocket@elists.org>
>> > Verzonden: vrijdag, maart 31, 2006 10:11
>> > Onderwerp: Re: [twsocket] Port number
>>
>>
>> >> Hello Werner,
>> >>
>> >> It is the exact peer port. I try to explain:
>> >>
>> >> -- for a server --
>> >> Server listens on a certain addr:port. Client connect to that port, but
>> >> server should stay listening, so the listening port has to be kept
> free,
>> >> so as fast as possible the socket is duped to another local port. This
>> >> port increase after each connect because the OS hold it in time_wait
>> >>
>> >> -- for a client --
>> >> Client connect to a certain addr:port. But local it is also bound to an
>> >> addr and port. This is the peer port when it is called by the server
>> >> end.
>> >>
>> >> ---
>> >> Rgds, Wilfried [TeamICS]
>> >> http://www.overbyte.be/eng/overbyte/teamics.html
>> >> http://www.mestdagh.biz
>> >>
>> >> Thursday, March 30, 2006, 20:58, Werner wrote:
>> >>
>> >> > Hi All,
>> >>
>> >> > Using WSocket and GetPeerPort. The client has for example port 2000
>> >> > When recieving a package then close again, then recieving -close,
>> >> > etc I receive 2001 then next package 2002, 2003, etc. as portNumber
>> >> > The portnumber seems to increase all the time, and not giving me
>> >> > the exact PeerPort like the PeerAddr wich is correct.
>> >>
>> >> > GetPeerPort , PeerPort give me not the peerport from the client.
>> >> > I have tested this in a local lan, maybe this would be the problem ?
>> >>
>> >> > Any idee how to get the actual portnumber from the client side, when
> the
>> > client is connected
>> >> > Thanks for any suggestions
>> >> > Greetings - Werner
>> >>
>> >>
>> >> -- 
>> >> To unsubscribe or change your settings for TWSocket mailing list
>> >> please goto http://www.elists.org/mailman/listinfo/twsocket
>> >> Visit our website at http://www.overbyte.be
>> >>
>> >>
>>
>>
>> -- 
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://www.elists.org/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
>>
>>


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to