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-m...@bama.ua.edu] On Behalf Of Frank Swarbrick Sent: Wednesday, November 04, 2009 7:34 PM To: IBM-MAIN@bama.ua.edu 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 -- Frank Swarbrick Applications Architect - Mainframe Applications Development FirstBank Data Corporation - Lakewood, CO USA P: 303-235-1403 On 11/4/2009 at 4:41 PM, in message <009d01ca5da8$4599d9c0$d0cd8d...@net>, Joe Reichman <joereich...@optonline.net> wrote: > Sorry if I wasn't clear When The SELECT macro/service senses a incoming > connection is there anyway that server can detect the socket that the client > is trying to connect to > > Typically if I use the Wrong (for lack of a better term) socket (on the > client side) the Select macro (on the server) senses a new connection but > the ACCEPT ECB (ECB to be posted by TCP/IP upon completion > > Of the ACCEPT) is never posted by TCP/IP > > -----Original Message----- > From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On Behalf > Of J R > Sent: Wednesday, November 04, 2009 4:55 PM > To: IBM-MAIN@bama.ua.edu > Subject: Re: Final Confusions on Concurrent Server > > I'm not sure I understand your question. > > > > The server would normally LISTEN for incoming CONNECT requests > on a socket address that has been made "well known". For example, > this could be IPAddress 66.102.7.139 and Port 80. This can also > be expressed as Socket 66.102.7.139:80 ~or~ 66.102.7.139..80 > > > The only way that the server knows that a client is trying to CONNECT > is if it receives a CONNECT request. As far as I'm aware, there is > no way for a server to know if someone is trying to CONNECT to > a socket that it's not LISTENing on. > > > > Sorry if I've misunderstood. > > > > ======= > > > >> Date: Wed, 4 Nov 2009 12:17:11 -0500 >> From: joereich...@optonline.net >> Subject: Re: Final Confusions on Concurrent Server >> To: IBM-MAIN@bama.ua.edu >> >> Is there a way for the server to know what port the client is trying >> to connect to >> > > > > > > > _________________________________________________________________ > Find the right PC with Windows 7 and Windows Live. > http://www.microsoft.com/Windows/pc-scout/laptop-set-criteria.aspx?cbid=wl&f > ilt=200,2400,10,19,1,3,1,7,50,650,2,12,0,1000&cat=1,2,3,4,5,6&brands=5,6,7,8 > ,9,10,11,12,13,14,15,16&addf=4,5,9&ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_ > WIN_evergreen2:112009 > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO > Search the archives at http://bama.ua.edu/archives/ibm-main.html > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO > Search the archives at http://bama.ua.edu/archives/ibm-main.html >>> 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 lists...@bama.ua.edu with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html