[go: up one dir, main page]

File: tcpUtilities.h

package info (click to toggle)
althea 0.5.5-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,196 kB
  • ctags: 725
  • sloc: cpp: 8,194; makefile: 214; sh: 44
file content (76 lines) | stat: -rw-r--r-- 1,851 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
//  tcpUtilities.h  --  read below for description
//  -- created 1/1/00  updated 1/1/00
//////////////////////////////////////////////////


////////////////////////////////////////////////////////////////
//
//	tcpUtilities.h
//
//	Adapted in C from Douglas Comer's "Internetworking
//		with TCP/IP" by Jeff Ondich and Lauren Jantz,
//		summer 1995.
//
//	Rewritten in C++, Jeff Ondich, January 2000
//
//	The functions prototyped here are used by the
//	example client (helloClient.cpp) and servers
//	(helloServer.cpp and helloConcurrent.cpp).
//
////////////////////////////////////////////////////////////////

// changes to allow comile on Suns and BSD Boxen thanks to Thomas Strmberg


#ifndef TCPUTILITIES_H
#define TCPUTILITIES_H
namespace std {};
using namespace std;

#include        <iostream>
#include        <sys/types.h>
#include        <sys/socket.h>
#include        <netinet/in.h>
#include        <arpa/inet.h>
#include        <unistd.h>
#include        <netdb.h>
#include        <errno.h>
#include        <string.h>
#include        <string>
#include        "connection.h"


// Solaris needs this for bzero/bcopy, and probably others.
#include               <strings.h>

// Solaris does not define this. 
#ifndef INADDR_NONE
       #define INADDR_NONE ((unsigned long int) 0xffffffff)
#endif






#define		DEFAULT_QUEUE_LENGTH 	5


/////////////////////////////////////
// Client function prototypes.
/////////////////////////////////////

AConPtr MakeConnection( const char *hostName, int port, bool usessl );


/////////////////////////////////////
// Client and server function
// prototypes.
/////////////////////////////////////

int ReadFromSocket( AConPtr, char *buffer, int nBytes );
void WriteToSocket( AConPtr, const char *buffer, int nBytes );
void GetPeerHostName( AConPtr, char *name, int nameArrayLimit );

#endif