Re: [twsocket] GetPeerName

2005-08-22 Thread Francois Piette
> I am using GetPeerName on an outgoing TXSocket to get/confirm the server
> details in the OnSessionConnected event.  I am specifically connecting to a
> fixed address and a fixed port.  The Address is returned correctly, however
> the port number (PeerName.sin_port) is never correct.
> 
> If I open a DOS window and use NETSTAT I see the expected port (i.e. the one
> I asked to connect to)
> 
> Is this a known issue?

It is likely that you confuse between local port and remote (peer) port.
NetStat show the local port while PeerName.sin_port returns the remote port.
Use TWSocket.GetXPort instead of TWSocket.PeerPort.
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
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


Re: [twsocket] GetPeerName

2005-08-22 Thread Wilfried Mestdagh
Hello John,

If you connect to a server, then the server accept the connection into a
local port which is different from the listening port. This is how
winsock works, because the Listening port stay listening.

this cannot be different because if the same port should be used for
data transfer then it cannot listen anymore because ip+port has to be
exclusive.

The listening port on the server is the port where the client connects
to, the local port on the server is the port where the connection is on
once it is accepted.

---
Rgds, Wilfried
http://www.mestdagh.biz

Monday, August 22, 2005, 14:23, Dr John M Porteous wrote:

> I am using GetPeerName on an outgoing TXSocket to get/confirm the server
> details in the OnSessionConnected event.  I am specifically connecting to a
> fixed address and a fixed port.  The Address is returned correctly, however
> the port number (PeerName.sin_port) is never correct.

> If I open a DOS window and use NETSTAT I see the expected port (i.e. the one
> I asked to connect to)

> Is this a known issue?

> Regards

> Dr John M Porteous

> Chemigraphic Ltd  Tele: 01293 543517
> (office)
> The Fleming CentreTele: 01293 843385 (DDI)
> Fleming Way   Fax:  01293 552859
> Crawley   Mobile: 07802 402 226
> RH10 9NF  Email:
> [EMAIL PROTECTED]



-- 
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