Hi to all,
To the forum admin: i'm having problems with my previous account "vishamr2000". I can't post msg with it. It says "not enough privilege...". Can you fix it? Itried to reach u via email but was unsuccessful. The message got truncated each time. Thx in advance..
Now i'm trying myself at network programming and I encountered the following problems:
1) When you have a main program that requires arguments, how do I execute it? For example:
I compiled the program file like this:Code:int main (int argc, char *argv[]) { ... if (argc != 3) { fprintf(stderr,"usage: tcpcli <IPaddress> <file pathname>"); exit(1); } ... }
I ran it like this:Code:gcc myClient.c -o myClient
I got the following error:Code:myClient 192.168.10.20 love.txt
and in this way as well:Code:bash: myClient: command not found
I got the following error:Code:./myClient 192.168.10.20 love.txt
Code:Segmentation fault
2)In Beej's guide to Network Programming, when we have to loop several times in order receive several packets and read them, he talked about circular
buffers. How do we implement that?
This is the part that is to be looped..How can I do it?Code:if ((numbytes=recv(sockfd, buf, MAXDATASIZE-1, 0)) == -1) { perror("recv"); exit(1); } buf[numbytes] = ’\0’; printf("Received: %s",buf);
Any help, pointers will be most appreciated...
Warm regards,
Visham



LinkBack URL
About LinkBacks


