New PDF release: Beej’s Guide to Network Programming Using Internet Sockets

By Brian “Beej Jorgensen” Hall

Show description

Read or Download Beej’s Guide to Network Programming Using Internet Sockets PDF

Similar operating systems books

Download e-book for kindle: Building a CISCO Network for Windows 2000 by Syngress

Home windows 2000 Deployment thoughts offers readers with all of the info they should make clever judgements approximately whilst and the way to take advantage of the Microsoft home windows 2000 working process, or no matter if to exploit it in any respect. method directors should be in a position to overview the hot gains of the home windows 2000 kinfolk, discover improvements to home windows 2000, and spot find out how to contain these improvements into their present place of work setting.

Read e-book online Connected Computing Environment PDF

When you consider that its first quantity in 1960, Advances in pcs has awarded specified assurance of recommendations in computing device undefined, software program, idea, layout, and purposes. It has additionally supplied individuals with a medium within which they could discover their topics in higher intensity and breadth than magazine articles frequently permit.

Extra resources for Beej’s Guide to Network Programming Using Internet Sockets

Example text

E. ) The upshot of this is that if you send() a two-byte short int from an Intel box to a Mac (before they became Intel boxes, too, I mean), what one computer thinks is the number 1, the other will think is the number 256, and vice-versa. The way to get around this problem is for everyone to put aside their differences and agree that Motorola and IBM had it right, and Intel did it the weird way, and so we all convert our byte orderings to “big-endian” before sending them out. Since Intel is a “little-endian” machine, it’s far more politically correct to call our preferred byte ordering “Network Byte Order”.

Connect() to server 2. out’’) 3. close() the connection Meanwhile, the server is handling the data and executing it: 1. accept() the connection from the client 2. recv(str) the command string 3. close() the connection 4. system(str) to run the command Beware! Having the server execute what the client says is like giving remote shell access and people can do things to your account when they connect to the server. For instance, in the above example, what if the client sends “rm -rf ˜”? It deletes everything in your account, that’s what!

6. h> struct hostent *gethostbyname(const char *name); struct hostent *gethostbyaddr(const char *addr, int len, int type); Description These functions map back and forth between host names and IP addresses. After all, you want an IP address to pass to connect(), right? But no one wants to remember an IP address. 35”. com”, and returns a struct hostent which contains tons of information, including the IP address. ) gethostbyaddr() takes a struct in_addr and brings you up a corresponding host name (if there is one), so it’s sort of the reverse of gethostbyname().

Download PDF sample

Beej’s Guide to Network Programming Using Internet Sockets by Brian “Beej Jorgensen” Hall


by George
4.3

Rated 4.99 of 5 – based on 38 votes