Roy van Dam / NetworkAPI

Dependents:   NetRelais TCP_Client_Example TCP_Server_Example UDP_Server_Example ... more

Revision:
8:cdee0f2b6ff0
Parent:
6:847a0b218e22
--- a/udp/socket.cpp	Wed Jul 18 19:43:12 2012 +0000
+++ b/udp/socket.cpp	Thu Sep 27 09:31:40 2012 +0000
@@ -35,7 +35,7 @@
     }
     
     // Open socket
-    this->_socket = ::socket(AF_INET, SOCK_DGRAM, 0);
+    this->_socket = lwip_socket(AF_INET, SOCK_DGRAM, 0);
     if (this->_socket < 0) {
         return -1;
     }
@@ -49,13 +49,13 @@
 Socket::send(Buffer &buffer, ip::Address &address, int port)
 {
     ip::Endpoint endpoint(address, port);
-    return this->send(buffer.pointer(), buffer.length(), endpoint);
+    return this->send(buffer.data(), buffer.length(), endpoint);
 }
 
 int
 Socket::send(Buffer &buffer, ip::Endpoint &endpoint)
 {
-    return this->send(buffer.pointer(), buffer.length(), endpoint);
+    return this->send(buffer.data(), buffer.length(), endpoint);
 }
 
 int
@@ -86,7 +86,7 @@
     this->_status = Socket::Sending;
     
     // Try to write the specified amount of bytes.
-    int bytes_written = ::sendto(this->_socket, data, size, 0,
+    int bytes_written = lwip_sendto(this->_socket, data, size, 0,
         (const struct sockaddr *)&native_endpoint, sizeof(native_endpoint));
     
     // Update status
@@ -99,9 +99,9 @@
 int
 Socket::receive(Buffer &buffer)
 {
-    int result = this->receive(buffer.pointer(), buffer.size());
+    int result = this->receive(buffer.data(), buffer.size());
     if (result >= 0) {
-        buffer.setLength(result);
+        buffer.length(result);
     }
     
     return result;
@@ -135,7 +135,7 @@
     this->_status = Socket::Receiving;
     
     // Try to read a packet from the socket.
-    int bytes_read = ::recvfrom(this->_socket, data, max_size, 0,
+    int bytes_read = lwip_recvfrom(this->_socket, data, max_size, 0,
         (struct sockaddr*)&native_endpoint, (u32_t *)&native_endpoint_size);
     
     // Update status and return