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

x
?
Solved

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

Posted on 2003-03-13
4
Medium Priority
?
202 Views
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
server.
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?
0
Comment
Question by:shuva
2 Comments
 
LVL 51

Accepted Solution

by:
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).
See
   man select
for details,
   man socket
   man bind
   man listen
   man read
might help also ;-)
0
 

Expert Comment

by:CleanupPing
ID: 9157076
shuva:
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 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

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