From 856bc99a57f7a01952e9621e4b014420abcaa7ca Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 12 Mar 2000 21:26:48 +0000 Subject: [PATCH] Added debuf printf()s to GSocket, git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6640 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/help/Makefile.in | 2 +- samples/sockets/client.cpp | 3 ++- samples/sockets/server.cpp | 1 + src/common/socket.cpp | 2 +- src/unix/gsocket.c | 10 ++++++++++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/samples/help/Makefile.in b/samples/help/Makefile.in index d6b570ab33..2828c680d8 100644 --- a/samples/help/Makefile.in +++ b/samples/help/Makefile.in @@ -17,7 +17,7 @@ PROGRAM=help OBJECTS=demo.o -DATAFILES=doc +DATAFILES=doc.cnt doc.hlp doc.hpj doc.tex doc.zip back.gif forward.gif books.gif contents.gif include ../../src/makeprog.env diff --git a/samples/sockets/client.cpp b/samples/sockets/client.cpp index 58c140087c..03a9f7247a 100644 --- a/samples/sockets/client.cpp +++ b/samples/sockets/client.cpp @@ -486,7 +486,8 @@ void MyFrame::OnTest3(wxCommandEvent& WXUNUSED(event)) m_sock->SetFlags(wxSOCKET_WAITALL); // Note that len is in kbytes here! - len = 32; + // Also note that Linux kernel 2.0.36 gives up at len > 27. + len = 28; buf1 = new char[len * 1024]; buf2 = new char[len * 1024]; diff --git a/samples/sockets/server.cpp b/samples/sockets/server.cpp index 63b2b96d35..441d5721ba 100644 --- a/samples/sockets/server.cpp +++ b/samples/sockets/server.cpp @@ -287,6 +287,7 @@ void MyFrame::Test3(wxSocketBase *sock) sock->SetFlags(wxSOCKET_WAITALL); sock->Read(&len, 1); + buf = new char[len * 1024]; sock->Read(buf, len * 1024); sock->Write(buf, len * 1024); diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 89ac01b97d..0f13466c0c 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -466,7 +466,7 @@ wxUint32 wxSocketBase::_Write(const void *buffer, wxUint32 nbytes) break; ret = GSocket_Write(m_socket, (const char *)buffer, nbytes); - + if (ret > 0) { total += ret; diff --git a/src/unix/gsocket.c b/src/unix/gsocket.c index a43156c9a5..5b3c647893 100644 --- a/src/unix/gsocket.c +++ b/src/unix/gsocket.c @@ -714,6 +714,8 @@ int GSocket_Write(GSocket *socket, const char *buffer, int size) int ret; assert(socket != NULL); + + printf( "GSocket_Write #1, size %d\n", size ); if (socket->m_fd == -1 || socket->m_server) { @@ -721,16 +723,22 @@ int GSocket_Write(GSocket *socket, const char *buffer, int size) return -1; } + printf( "GSocket_Write #2, size %d\n", size ); + /* If the socket is blocking, wait for writability (with a timeout) */ if (_GSocket_Output_Timeout(socket) == GSOCK_TIMEDOUT) return -1; + printf( "GSocket_Write #3, size %d\n", size ); + /* Write the data */ if (socket->m_stream) ret = _GSocket_Send_Stream(socket, buffer, size); else ret = _GSocket_Send_Dgram(socket, buffer, size); + printf( "GSocket_Write #4, size %d\n", size ); + if (ret == -1) { if (errno == EWOULDBLOCK) @@ -747,6 +755,8 @@ int GSocket_Write(GSocket *socket, const char *buffer, int size) return -1; } + printf( "GSocket_Write #5, size %d ret %d\n", size, ret ); + return ret; } -- 2.45.2