anduril426, I know about beej's guide. I'm not that found of it! A lot of people swear by it but, this is the tutorial I have been using from the beginning so I'm going to stick with it thanks! And as for bcopy, yeah a lot of tutorials use it As well as books. I actually went to Barns&Nobels to order a *Nix TCP Socket book and the newest they had was from 1999-2001. But is using memcpy a necessary switch? And the way I learn is to memorize something. I start off coding it, over and over. As I go along, I study what the functions are and what they do, how they work. Im not just memorizing. Im practicing, using compiling. Dreaming of it lol That is what I meant!
MK27 & anduril426,....
That's what I have and how I'm coding it. It compiles and runs here's the core of the code
Code:
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
fprintf("ERROR opening socket");
bzero((char *) &serv_addr, sizeof(serv_addr));
server = gethostbyname(argv[1]);
if (server == NULL)
fprintf(stderr,"ERROR, no such host\n");
portno = atoi(argv[2]);
serv_addr.sin_family = AF_INET;
/*bcopy(src, dest, len)*/
bcopy((char *)server->h_addr,
(char *)&serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(portno);
if (connect(sockfd,(struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0)
fprintf(stderr, "ERROR connecting");
@Brewbuck, I am only a year and a half into programming in c all together. Still wet behind the ears! And I am completely new to socket programming. Only a few months at most. I do not hack! It's bad news, although seems very interesting! But these are the tutorials I am using. They are using bcopy, I can't help that! But I will learn the alternatives! If you don't mind me asking, why is bcopy so bad to use?
Sent from my iPhone