src/proto2/NetworkUDP.cc
branchno-netsession
changeset 37 ed2957490bbf
parent 33 e53f09b378f4
child 39 cfb8b6e2a35f
--- a/src/proto2/NetworkUDP.cc	Thu Nov 20 19:25:56 2008 +0000
+++ b/src/proto2/NetworkUDP.cc	Thu Nov 20 20:27:12 2008 +0000
@@ -1,8 +1,11 @@
 
 #include "NetworkUDP.hh"
 
+#include <ClanLib/core.h>
+#include <cassert>
+
 NetworkUDP::NetworkUDP (void) : 
-    socket(udp, ipv4) {
+    socket(CL_Socket::udp, CL_Socket::ipv4) {
     
     // do not bind
 
@@ -11,7 +14,7 @@
 }
 
 NetworkUDP::NetworkUDP (const NetworkAddress &bind_addr) :
-    socket(udp, ipv4) {
+    socket(CL_Socket::udp, CL_Socket::ipv4) {
     
     // bind socket
     socket.bind(bind_addr);
@@ -40,7 +43,7 @@
     pkt.set_data_size(ret);
 
     // handle packet
-    sig_packet(pkt, src);
+    _sig_packet(pkt, src);
 }
         
 bool NetworkUDP::sendto (const NetworkPacket &packet, const NetworkAddress &dst) {
@@ -48,15 +51,17 @@
 
     // XXX: shouldn't get trimmed
     try {
-        ret =socket.send(packet.get_buf(), packet.get_data_size(), dst);
+        ret = socket.send(packet.get_buf(), packet.get_data_size(), dst);
 
     } catch (CL_Error &e) {
         // XXX: catch some errors, but not others?
         return false;
     }
+
+    assert(ret > 0);
     
     // UDP shouldn't trim packets
-    assert(ret == packet.get_data_size());
+    assert((unsigned int) ret == packet.get_data_size());
     
     // good
     return true;