SMTP-1 - COP 3330 Spring 2004 #include /...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 3330 Spring 2004 #include <stdio.h> // <stdio.h> defines the public interface to three text io-stream objects: stdin, stdout, stderr // the io-stream abstraction provides functions for opening, closing, and transferring character // strings to an from these streams. //#define LINUX /* define this if you are on linux */ //#define WIN32 /* define this if you are on windows */ #ifdef WIN32 # include "io.h" # include "winsock2.h" /* WSAGetLastError, WSAStartUp */ # define snprintf _snprintf #endif #ifdef LINUX # include <netdb.h> /* gethostbyname */ # include <netinet/in.h> /* htons */ # include <sys/socket.h> #endif // The #ifdefs above, coupled with the #defines for WIN32 and LINUX, enable the programmer // to define the proper public interface with the host operating system for accessing the // socket abstraction supported by those systems. This improves code portability. // An advantage with Java over C is that a single socket abstraction is provided. // The Java compiler takes care of the details for mapping the Java-defined interface to the // socket abstraction provided by the host operating system – in C, this mapping is the // programmer’s responsibility. static void sendmail_write( const int sock, /* socket number */ const char *fmtstr, /* format string */ const char *argstr /* printf arg */ ) { /* The purpose of this function is to prepare a data string and output it to the socket object
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/04/2011 for the course COP 3330 taught by Professor Staff during the Summer '08 term at University of Central Florida.

Page1 / 3

SMTP-1 - COP 3330 Spring 2004 #include /...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online