Re: Final Confusions on Concurrent Server
- From: frank.swarbrick@xxxxxxxxxxxxxx (Frank Swarbrick)
- Date: 4 Nov 2009 17:22:52 -0800
I certainly misunderstood then (though luckily all of my information is still accurate!). As Chuck Arney said, once you ACCEPT a socket the address structure that is returned contains the IP address and port that the client connected from. (That is, the same information that you would get if you used GETPEERNAME on the socket that is returned by ACCEPT.)
Frank
--
Frank Swarbrick
Applications Architect - Mainframe Applications Development
FirstBank Data Corporation - Lakewood, CO USA
P: 303-235-1403
On 11/4/2009 at 6:09 PM, in message <009e01ca5db4$abfc1000$03f43000$@net>, Joe
Reichman <joereichman@xxxxxxxxxxxxx> wrote:
Seems like I am looking for GETPERNAME after the SELECT to see the port that
the client is using
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@xxxxxxxxxxx] On Behalf
Of Frank Swarbrick
Sent: Wednesday, November 04, 2009 7:34 PM
To: IBM-MAIN@xxxxxxxxxxx
Subject: Re: Final Confusions on Concurrent Server
The SELECT macro returns a bitmap of sockets, with the ones set to 1 (and
not 0) being the ones that been connected to (assuming the socket is a
listener socket). You simply do an ACCEPT of that socket. Your program I
would think already knows what listener sockets are mapped to what port.
But if that is not enough you can simply use GETSOCKNAME service and it will
return to you the local IP address and port number that is assigned to that
socket. This is similar to GETPEERNAME, which returns the remote IP address
and port (rather than the local).
Since your message seemed to be garbled at the end I'm not sure if this is
exactly what you are looking for, but I hope it helps.
I guess the thing that is unclear to many is that the listener socket and
the "connected" socket (that is returned when you ACCEPT on a listener
socket) will always have the same local port. That's why GETSOCKNAME won't
really get you something that you do not already know. On the other hand I
use it (GETSOCKNAME) myself just "because it's there". I guess the one
thing it gives you, I think, is the actual IP address that the remote host
connected to. This could be of interest if you have multiple IP addresses
assigned, and you are simply listening on all of them (ANY_ADDR, or
"0.0.0.0"). But the local port is the port is the port, and does not
change.
Frank
The information contained in this electronic communication and any document attached hereto or transmitted herewith is confidential and intended for the exclusive use of the individual or entity named above. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any examination, use, dissemination, distribution or copying of this communication or any part thereof is strictly prohibited. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy this communication. Thank you.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to listserv@xxxxxxxxxxx with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html
.
- References:
- Final Conlusions on Concurrenrt Server
- From: Joe Reichman
- Re: Final Conlusions on Concurrenrt Server
- From: Shmuel Metz , Seymour J.
- Re: Final Confusions on Concurrent Server
- From: J R
- Re: Final Confusions on Concurrent Server
- From: Joe Reichman
- Re: Final Confusions on Concurrent Server
- From: Frank Swarbrick
- Re: Final Confusions on Concurrent Server
- From: Joe Reichman
- Final Conlusions on Concurrenrt Server
- Prev by Date: Re: Final Confusions on Concurrent Server
- Next by Date: Re: Health Checker - LNKLST Datasets
- Previous by thread: Re: Final Confusions on Concurrent Server
- Next by thread: Re: Final Confusions on Concurrent Server
- Index(es):
Relevant Pages
|