Solved

Getting remote socket within inetd server

Posted on 1997-08-29
1
273 Views
Last Modified: 2013-12-23
I have written a couple of servers that work with inetd and I need to be able to get the IP of the connected host.

So, how do I get the remote socket from the stdin handle?
0
Comment
Question by:dogma
1 Comment
 

Accepted Solution

by:
bkc earned 100 total points
Comment Utility
If you are using the FILE * stdin, you can get the file handle using the fileno() function.

struct sockaddr_in sin;
int slen = sizeof(sin);
int rc = getpeername(fileno(stdin), &sin, &slen);

I suspect that the result from fileno(stdin) is 0, since stdin is
always handle 0 and inetd dups its socket as handle 0 before spawning your server.

0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Don’t let your business fall victim to the coming apocalypse – use our Survival Guide for the Fax Apocalypse to identify the risks and signs of zombie fax activities at your business.
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now