Re: About the function inet_ntoa()
From: Måns Rullgård (mru_at_mru.ath.cx)
Date: 09/29/04
- Next message: Barry Margolin: "Re: running TCP client in background mode problem"
- Previous message: Brian Raiter: "Re: Can you select() socketpair()-generated descriptors?"
- In reply to: learning_C++: "About the function inet_ntoa()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 29 Sep 2004 22:19:25 +0200
learning_c@hotmail.com (learning_C++) writes:
> I have two programs: one for client and one for server.
> In the client.c,
> -------------------------------------------------
> cin2.sin_family = AF_INET;
> inet_aton("130.233.248.203",&(cin2.sin_addr));
> cin2.sin_port = htons(PORT);
> a1=inet_ntoa(cin2.sin_addr);
> printf("The IP value is: %s\n", a1);
> //printf("Trying to connect to %s = %s =
> %s\n",HOST,inet_ntoa(cin.sin_addr),inet_ntoa(cin2.sin\
> _addr));
> printf("Trying to connect to %s = %s =
> %s\n",HOST,inet_ntoa(cin.sin_addr),a1);
> ----
> a1=130.233.248.203. But after the function printf()is called it
> changed to a1=130.233.248.198.
$ man inet_ntoa
[...]
The inet_ntoa() function converts the Internet host address in given in
network byte order to a string in standard numbers-and-dots notation.
The string is returned in a statically allocated buffer, which subse-
quent calls will overwrite.
> -------------------------------------------------------------
> My command line argument is : client 2+3
> The output is "Server responded with 2 + 3 = 5"
> But when I input client 2*3
> The output is: "client: No match."
> What is wrong?
You are using tcsh, which although by many considered wrong, is your
choice. Remember the special meaning of * in the shell? Apparently
you have no files matching the pattern 2*3, in which case tcsh prints
this message. The solution is to quote the argument, "2*3". I'm
pretty sure this is covered in the tcsh man page, but I don't have it
installed so I can't check.
You should really get used to reading man pages. It's often much
quicker than posting a question here and waiting for an answer.
-- Måns Rullgård mru@mru.ath.cx
- Next message: Barry Margolin: "Re: running TCP client in background mode problem"
- Previous message: Brian Raiter: "Re: Can you select() socketpair()-generated descriptors?"
- In reply to: learning_C++: "About the function inet_ntoa()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|