[ wxwindows-Bugs-1532472 ] TimeOut with wxSocketBase on Linux
SourceForge.net
noreply at sourceforge.net
Fri Jun 22 06:44:02 PDT 2007
Bugs item #1532472, was opened at 2006-08-01 16:45
Message generated for change (Comment added) made by cwalther
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1532472&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Socket
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: David Amar (wxdormeur)
Assigned to: Angel Vidal Veiga (elkry)
Summary: TimeOut with wxSocketBase on Linux
Initial Comment:
With wxGTK, when a timeout occurs it raises
wxSOCKET_IOERR instead of wxSOCKET_TIMEDOUT (like wxMSW
does)
Here is a sample on code in a thread main entry.
It opens a connection to server mpServer on port mpPort
and read data. It test with SSH (port=22) with
wxWidgets 2.6.3 and Linux Fedora Core 3.
ExitCode Entry()
{
wxLogDebug("Thread Entry");
mpSocket = new wxSocketClient(wxSOCKET_NONE |
wxSOCKET_BLOCK);
wxIPV4address adr;
adr.Hostname(mpServer);
adr.Service(mpPort);
mpSocket->SetTimeout(1);
mpSocket->Connect(adr, true);
if (!mpSocket->IsConnected())
{
wxLogError("Connection fails");
return NULL;
}
const wxUint32 BUF_SIZE = 512;
wxByte buffer[BUF_SIZE];
while (!TestDestroy())
{
mpSocket->Read(buffer, BUF_SIZE);
if (mpSocket->Error())
{
wxSocketError err = mpSocket->LastError();
if (err == wxSOCKET_TIMEDOUT)
{
wxLogDebug("Timeout!");
continue;
}
else
{
wxLogDebug("Error in socket: %d", err);
break;
}
}
else
{
wxLogDebug("Read %d bytes", mpSocket->LastCount());
}
}
wxLogDebug("Thread ends");
return NULL;
}
----------------------------------------------------------------------
Comment By: Christian Walther (cwalther)
Date: 2007-06-22 15:44
Message:
Logged In: YES
user_id=1061789
Originator: NO
I just ran into this bug in wxGTK 2.6.3, then found out that it has been
fixed in src/unix/gsocket.cpp rev. 1.52
<http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/src/unix/gsocket.cpp#rev1.52>,
so I suppose this tracker item can be closed.
----------------------------------------------------------------------
Comment By: Angel Vidal Veiga (elkry)
Date: 2006-08-01 18:49
Message:
Logged In: YES
user_id=588952
I'll take a look at it while I rewrite for SoC.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1532472&group_id=9863
More information about the wx-dev
mailing list