Re: Network Programming in C on Linux ... Pls Help
On Sun, 11 Nov 2001 10:44:01 +0530, <shyamk@eth.net> wrote:
> Dear members ,
> I am having some serious doubts (generated by a vague book
> and my ignorance/stupidity combined together).
It might help if you mentioned the name of the book! This question is
really off topic here, and better posted in comp.unix.programmer or
some such.
> 1) First , I wish to talk about the memset function
> used in the TCPEchoServer.c program .
>
> This function takes 3 arguments as far as the documentation is concerned , but the
> program (and all programs using this function ,) just pass 2 arguments. This gives us
> the following error :
"memset" takes three arguments. It's standard C. A similar BSD derived function
"bzero" only takes two.
void * memset (void *, int, size_t);
> tcpechoserv.c : In function 'main' :
> tcpechoserv :22 : too few arguments to function 'memset'
>
> When I supplied a 0 for the (hitherto) unspecified parameter , I get complaints
> about the readline function.
You don't provide a readline() function and no such function exists via the
headers included.
> 2) The next question is regarding the UdpEchoServer.c
>
> I am getting the error :
> udpechoserver.c : In function 'main' :
> udpechoserv.c : 33 : incompatible type for argument 5 of 'sendto'
>
> This is what the sendto function looks like :
> sendto(socketDescriptor,line,n,0,clientAddr,clientAddrLen);
"clientAddr" probably needs a cast to the correct socket type ??? Can't
tell without the declarations for "sendto" and "clientAddr".
> In the same book from which I took all these , there is a
> topic on RPC contains little instruction on what to do .
> a)It gives one msg.x ,file (which anyway rpcgen shows an error :
> msg.x : line 5: expected 'version' or '}' )
> b)What do we do with the server C program , that follows the msg.x file (a msg-proc.c
> file)?
How should we know?
> c) And they have not mentioned any .x files for the client
> d) What What do we do with the server C program shown for the client ?
Again, how should we know?
> e)They show in the next 2 pages the C programs that rpcgen generates ,
> but it remains vague , because ,the text never manages to take our programs there.
>
> Could somebody give me pointers to good sites where I can get good code
> examples in RPC server/clients ? Or could somebody give me some code examples (I
> guess
> it takes 6 files: 1 .x file and .c file for the server , and 1 .x and .c file
> for the client
> + the 2 .c files that rpcgen is supposed to generate .)
The Richard Stevens books _UNIX Network Programming_ cover these topics in detail.
Code is available from a website. But read the text, so you know why you're
doing XYZ thing.
--
Eric G. Miller <egm2@jps.net>
Reply to: