Revision: 7566
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7566&view=rev
Author:   gbiggs
Date:     2009-03-31 07:31:00 +0000 (Tue, 31 Mar 2009)

Log Message:
-----------
Changed a write() to a send() and made remote_driver.cc compile on Windows 
again.

Modified Paths:
--------------
    code/player/trunk/libplayertcp/remote_driver.cc

Modified: code/player/trunk/libplayertcp/remote_driver.cc
===================================================================
--- code/player/trunk/libplayertcp/remote_driver.cc     2009-03-31 04:00:09 UTC 
(rev 7565)
+++ code/player/trunk/libplayertcp/remote_driver.cc     2009-03-31 07:31:00 UTC 
(rev 7566)
@@ -264,12 +264,20 @@
 
   while(numbytes < encode_msglen)
   {
-    if((thisnumbytes = write(this->sock, buf+numbytes,
-                             encode_msglen-numbytes)) < 0)
+    thisnumbytes = send(this->sock, reinterpret_cast<const char*> 
(buf+numbytes), encode_msglen-numbytes, 0);
+    if(thisnumbytes < 0)
     {
-      if(errno != ERRNO_EAGAIN)
+      if(ErrNo != ERRNO_EAGAIN)
       {
-        PLAYER_ERROR1("write failed: %s", strerror(errno));
+#if defined (WIN32)
+        LPVOID buffer = NULL;
+        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 
FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+                      ErrNo, 0, reinterpret_cast<LPTSTR> (&buffer), 0, NULL);
+        PLAYER_MSG1(2, "send() failed: %s", reinterpret_cast<LPTSTR> (buffer));
+        LocalFree(buffer);
+#else
+        PLAYER_MSG1(2,"send() failed: %s", strerror(ErrNo));
+#endif
         return(-1);
       }
     }
@@ -295,7 +303,7 @@
   numbytes = 0;
   while(numbytes < PLAYERXDR_MSGHDR_SIZE)
   {
-    thisnumbytes = recv(this->sock, buf+numbytes, 
PLAYERXDR_MSGHDR_SIZE-numbytes, 0);
+    thisnumbytes = recv(this->sock, reinterpret_cast<char*> (buf+numbytes), 
PLAYERXDR_MSGHDR_SIZE-numbytes, 0);
     if(thisnumbytes < 0)
     {
       if(ErrNo != ERRNO_EAGAIN)
@@ -351,7 +359,7 @@
   numbytes = 0;
   while(numbytes < (int)hdr.size)
   {
-    thisnumbytes = recv(this->sock, buf+PLAYERXDR_MSGHDR_SIZE+numbytes, 
hdr.size-numbytes, 0);
+    thisnumbytes = recv(this->sock, reinterpret_cast<char*> 
(buf+PLAYERXDR_MSGHDR_SIZE+numbytes), hdr.size-numbytes, 0);
     if(thisnumbytes < 0)
     {
       if(ErrNo != ERRNO_EAGAIN)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to