Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Can there be socket connection without nowing the port, given socket descriptor?

Posted on 2003-03-13
Medium Priority
Last Modified: 2013-12-23
Hi ,
I am new to this socket programming in UNIX.
OK here is my doubt.
I am using a third part CAPI. Th API makes connection to
a server which periodically sends message to my C program.
There is a API call ifGetSocket(int id) which would
give me the socket descriptor. id is an int maintained by
the third part to identify various sessions.
The Help says:
This socket descriptor returned by this API call can
be used in UNIX select call to check any message was sent by the
The connection to the server is established and I can send message to the server
but I dont know which port it used to connect. I know the server name and the
socket descriptor.
My question is:
Is it possible to receive messages with just the server name and socket descriptor?
Question by:shuva
LVL 51

Accepted Solution

ahoffmann earned 200 total points
ID: 8135762
the handle id is all you need, just feed it to the select() function, if select returns do appropriate work (for example reading from id).
   man select
for details,
   man socket
   man bind
   man listen
   man read
might help also ;-)

Expert Comment

ID: 9157076
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Unable to change the program that handles the scan event from a network attached Canon/Brother printer/scanner. This means you'll always have to choose which program handles this action, e.g. ControlCenter4 (in the case of a Brother).
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question