Changeset 7777 in orxonox.OLD for branches/network/src/lib/network/udp_socket.cc
- Timestamp:
- May 23, 2006, 4:21:02 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/udp_socket.cc
r7613 r7777 17 17 #include "udp_server_socket.h" 18 18 19 #include "network_log.h" 19 20 20 21 void UdpSocket::init( ) … … 151 152 bool UdpSocket::writePacket( byte * data, int length ) 152 153 { 154 NETPRINTF(0)("adsf\n"); 153 155 if ( serverSocket ) 154 156 { 157 NETPRINTF(0)("adsf\n"); 155 158 NetworkPacket networkPacket; 156 159 networkPacket.length = length; 157 160 networkPacket.data = data; 161 NETPRINTF(0)("adsf\n"); 158 162 if ( !serverSocket->sendPacket( networkPacket, this->userId ) ) 159 163 { 164 NETPRINTF(0)("adsf\n"); 160 165 bOk = false; 161 166 return false; 162 167 } 163 168 else 169 { 170 NETPRINTF(0)("adsf\n"); 164 171 return true; 172 } 173 NETPRINTF(0)("adsf\n"); 165 174 } 166 175 else 167 176 { 177 if ( !socket ) 178 return false; 179 180 NETPRINTF(0)("adsf\n"); 168 181 assert( length <= packet->maxlen ); 169 182 183 NETPRINTF(0)("adsf\n"); 170 184 memcpy( packet->data, data, length ); 185 NETPRINTF(0)("adsf\n"); 171 186 packet->len = length; 172 187 188 NETPRINTF(0)("adsf\n"); 173 189 if ( SDLNet_UDP_Send( socket, 1, packet) == 0 ) 174 190 { 191 NETPRINTF(0)("adsf\n"); 175 192 PRINTF(1)("SDLNet_UDP_Send: %s\n", SDLNet_GetError()); 176 193 bOk = false; … … 178 195 } 179 196 197 NETPRINTF(0)("adsf\n"); 180 198 return true; 181 199 } 200 NETPRINTF(0)("adsf\n"); 182 201 } 183 202
Note: See TracChangeset
for help on using the changeset viewer.