linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edward Parrilla <eparrilla@comcast.net>
To: linux prg <linux-c-programming@vger.kernel.org>
Subject: mapping client to port
Date: 07 Oct 2004 01:34:21 -0500	[thread overview]
Message-ID: <1097130850.4086.838.camel@localhost.localdomain> (raw)
In-Reply-To: <6.1.1.1.0.20041006171515.04d4c6b8@no.incoming.mail>

Hi all,
sorry again for bothering you:

I have the following entry to do:

myprog port1 port2 servname 
that will be executed from the client's command line.

where
port1 is the client's port
port2 is the server's port
and servname is the server to which I want to connect.

In order to associate port2 with servername I have to create a 
struct servent *serv;
struct socket_in *fin;

then associate it with 
fin.sin_port -->getservbyname(port2)

the question is how do to associate the port1 to the local host?

is it valid if I do:
fin.in_port = htons(atoi(port1))

Thanks in advance for your help
Edward




  parent reply	other threads:[~2004-10-07  6:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-06 10:44 C language(asm construct) Ankit Jain
2004-10-06 21:47 ` passing host name from a structure Edward Parrilla
2004-10-06 22:44   ` Alphex Kaanoken
2004-10-07  2:02     ` Edward Parrilla
2004-10-07  5:03   ` Jeff Woods
2004-10-07  6:23     ` Edward Parrilla
2004-10-07  6:34     ` Edward Parrilla [this message]
2004-10-08 15:02 ` C language(asm construct) Suciu Flavius

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1097130850.4086.838.camel@localhost.localdomain \
    --to=eparrilla@comcast.net \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).