Changeset 5565 in orxonox.OLD for branches/network/src/lib/network/network_socket.cc
- Timestamp:
- Nov 14, 2005, 11:06:20 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/network_socket.cc
r5542 r5565 10 10 11 11 ### File Specific: 12 main-programmer: ...13 co-programmer: ...12 main-programmer: Christoph, David Hasenfratz 13 co-programmer: 14 14 */ 15 15 … … 24 24 #include "network_socket.h" 25 25 26 /* header for debug output */ 27 #include "debug.h" 28 26 29 27 30 /** … … 29 32 */ 30 33 NetworkSocket::NetworkSocket() 31 {} 34 { 35 36 /* Init SDL_net */ 37 if(SDLNet_Init()==-1) 38 { 39 PRINTF(1)("SDLNet_Init: %s\n", SDLNet_GetError()); 40 return; 41 } 42 else 43 PRINTF(5)("SDL_net initialized\n"); 44 45 } 32 46 33 47 /** … … 36 50 NetworkSocket::~ NetworkSocket( ) 37 51 { 52 53 /* Quit SDL_net */ 54 SDLNet_Quit(); 55 PRINTF(5)("SDL_net shutdown\n"); 38 56 } 39 57 40 58 /** 41 * Connect to another host 42 */ 43 void NetworkSocket::connectToServer( ) 59 * This function establishes a TCP/UDP connection to a given server (function argument). 60 * It is called by the NetworkStream. It creates a TCP/UDP socket for the connection. 61 */ 62 void NetworkSocket::connectToServer(IPaddress ip, unsigned int port) 44 63 { 45 64 } 46 65 47 66 /** 48 * Listen to a port number for incoming connections 49 */ 50 void NetworkSocket::listen( ) 67 * Tells the NetworkSocket to listen on a specific port for incoming connections. 68 * NetworkSocket::writeBytes(...) will have no effect until there is a valuable connection. 69 */ 70 void listen(unsigned int port) 51 71 { 52 72 } 53 73 54 74 /** 55 * D isconnect from server75 * DTears down a TCP/UDP connection. 56 76 */ 57 77 void NetworkSocket::disconnectServer( ) … … 60 80 61 81 /** 62 * Write some data 63 */ 64 void NetworkSocket::writeBytes( ) 82 * This function writes some bytes (data) to the network connection (if the connection is already 83 * estabilhed) otherwise it just does nothing (silently discarding the data). And writes some 84 * warnings 85 */ 86 void NetworkSocket::writeBytes(byte* data) 65 87 { 66 88 } 67 89 68 /** 69 * Read some data 70 */ 71 void NetworkSocket::readBytes( ) 90 /** 91 * Reads in the bytes from the network interface and passes it to the NetworkStream. 92 * This function must internaly be implemented/connected as a thread, since the read 93 * functions of many network libraries are blocking an would therefore block the whole 94 * program. 95 * From outside, the thread shouldn't be accessible at all. 96 */ 97 byte* NetworkSocket::readBytes() 72 98 { 73 99 } 74
Note: See TracChangeset
for help on using the changeset viewer.