[ wxwindows-Bugs-1532472 ] TimeOut with wxSocketBase on Linux
SourceForge.net
noreply at sourceforge.net
Tue Aug 1 07:45:24 PDT 2006
Bugs item #1532472, was opened at 2006-08-01 16:45
Message generated for change (Tracker Item Submitted) made by Item Submitter
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: wxGTK specific
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: David Amar (wxdormeur)
Assigned to: Nobody/Anonymous (nobody)
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;
}
----------------------------------------------------------------------
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