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:
Code:
int main (int argc, char *argv[])
{
...
if (argc != 3) {
fprintf(stderr,"usage: tcpcli <IPaddress> <file pathname>");
exit(1);
}
...
}
I compiled the program file like this:
Code:
gcc myClient.c -o myClient
I ran it like this:
Code:
myClient 192.168.10.20 love.txt
I got the following error:
Code:
bash: myClient: command not found
and in this way as well:
Code:
./myClient 192.168.10.20 love.txt
I got the following error:
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?
Code:
if ((numbytes=recv(sockfd, buf, MAXDATASIZE-1, 0)) == -1) {
perror("recv");
exit(1);
}
buf[numbytes] = ’\0’;
printf("Received: %s",buf);
This is the part that is to be looped..How can I do it?
Any help, pointers will be most appreciated...
Warm regards,
Visham