By M. Tim Jones

BSD Sockets Programming from a Multi-Language viewpoint is written for software program builders who have to create quite a few community functions. It starts through detailing the effective and potent makes use of of the BSD Sockets API for networked program improvement in a number of languages. From there the BSD API is roofed intimately and the aim of every functionality and socket alternative is pointed out, together with the complex behavioral side-effects of every. Having an intensive realizing of those concerns and methods is frequently the adaptation among being a beginner community software developer. Optimizing networked purposes and heading off universal pitfalls also are addressed. After the forged foundational assurance of the Sockets API partially I, half II investigates it from numerous language views. utilizing six assorted languages in all, together with relevant languages (C), object-oriented languages (Java), and scripting languages (Perl), you study the benefits and drawbacks of every language as they relate to the improvement of networked purposes and the Sockets API. eventually, partially III, a suite of software program styles is mentioned for every language. styles contain an easy HTTP server and SMTP purchaser, and diverse Sockets conversation kinds (stream, datagram, multicast, and broadcast). those styles can be utilized because the foundation for extra advanced purposes or to provide you a quick-start while development networked functions. The styles additionally light up the variations among the community APIs for every language and determine how yes languages make styles basic and others lead them to advanced. The accompanying CD-ROM comprises all the resource code from the ebook, together with the styles special partially III, in addition to open resource interpreters and different instruments.

Show description

Read Online or Download BSD Sockets Programming from a Multi-Language Perspective PDF

Best software design & engineering books

Concurrent Programming in ML

Concurrent Programming ML (CML), integrated as a part of the SML of latest Jersey (SML/NJ) distribution, combines the simplest positive factors of concurrent programming and practical programming. This functional, "how-to" e-book makes a speciality of using concurrency to enforce evidently concurrent purposes. as well as an educational advent to programming in CML, the publication provides 3 prolonged examples utilizing CML for functional platforms programming: a parallel software program construct procedure, an easy concurrent window supervisor, and an implementation of dispensed tuple areas.

Deploying OpenLDAP

. .. i used to be excited to work out Deploying OpenLDAP, by way of Tom Jackiewicz and released via Apress, on Amazon's digital bookshelf. After reviewing the desk of Contents I speedy ordered the ebook. For all of the paintings and time invested in utilizing LDAP, no longer adequate time has been spent designing the format and the good judgment of directories.

The Computer, the Writer and the Learner

Desktops are progressively infiltrating all levels of the writing approach. more and more, lecturers, writers, scholars, software program builders, technical authors, and machine scientists have to research extra concerning the potent use of desktops for writing. This e-book discusses how desktops may also help aid writing.

Additional info for BSD Sockets Programming from a Multi-Language Perspective

Example text

The protocol field (s_proto) identifies the protocol required for the particular service. The s_aliases list defines some other service names that can be used. If the application uses an alias in the getservbyname call, the official name still appears in the s_name field of the servent structure. 13 Complete example of getservbyname. h> struct servent *sp; int i; sp = getservbyname( "smtp", "tcp" ); if (sp) { printf( "s_name = %s\n", sp->s_name ); printf( "s_port = %d\n", ntohs(sp->s_port) ); printf( "s_proto = %s\n", sp->s_proto ); i = 0; printf( "Aliases:\n" ); while (1) { if ( sp->s_aliases[i] ) { printf(" s_aliases[%d] = %s\n", i, sp->s_aliases[i] ); i++; } else break; } } An item to note with getservbyname is that although the application may know the service name of interest, Chapter 4: Advanced Sockets Functions 55 56 Chapter 4: Advanced Sockets Functions it may not know the protocol over which it operates.

4: MOST COMMON FLAGS FOR THE send/sendto FUNCTIONS Flag MSG_OOB Description Requests transmission of out-of-band data through the socket MSG_DONTWAIT Forces this call to be nonblocking MSG_DONTROUTE Bypasses routing tables The MSG_DONTWAIT flag makes this call nonblocking. This means that the call doesn’t block if it’s unable to queue all of the user buffer data in the socket send buffer. In this case, the number of bytes consumed in the user buffer is returned. The socket could also be made nonblocking for all calls, which differs depending upon the particular API being used.

Struct sockaddr_in { int16_t sin_family; uint16_t sin_port; struct in_addr sin_addr; char sin_zero[8]; }; struct in_addr { uint32_t s_addr; }; For Internet communication using the IPv4 protocol suite, we’ll use AF_INET solely for sin_family. Field sin_port is used to define our specified port number in network byte order. Therefore, we must use htons to load the port and ntohs to read it from this structure. Field sin_addr is, through s_addr, a 32-bit field that represents an IPv4 Internet address.

Download PDF sample

Rated 4.15 of 5 – based on 35 votes