// Author: Lukasz Michalski
// Modified by:
// Created: 27.06.2005
-// RCS-ID: $Id$
// Copyright: (c) 2005 Lukasz Michalski <lmichalski@sf.net>
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
return 0;
}
-// Create buffer to be sent by client. Buffer contains test indicator
+// Create buffer to be sent by client. Buffer contains test indicator
// message size and place for data
-// msgsize parameter contains size of data in bytes and
+// msgsize parameter contains size of data in bytes and
// if input value does not fit into 250 bytes then
// on exit is updated to new value that is multiply of 1024 bytes
char*
char* buf;
//if message should have more than 256 bytes then set it as
//test3 for compatibility with GUI server sample
- if ((*msgsize) > 250)
+ if ((*msgsize) > 250)
{
//send at least one kb of data
int size = (*msgsize)/1024 + 1;
//returned buffer will contain test indicator, message size in kb and data
bufsize = size*1024+2;
buf = new char[bufsize];
- buf[0] = 0xDE; //second byte contains size in kilobytes
+ buf[0] = (unsigned char)0xDE; //second byte contains size in kilobytes
buf[1] = (char)(size);
*msgsize = size*1024;
}
//returned buffer will contain test indicator, message size in kb and data
bufsize = (*msgsize)+2;
buf = new char[bufsize];
- buf[0] = 0xBE; //second byte contains size in bytes
+ buf[0] = (unsigned char)0xBE; //second byte contains size in bytes
buf[1] = (char)(*msgsize);
}
return buf;
void
Client::StartWorker(workMode pMode, const wxString& pMessage) {
- char* tmpbuf = strdup(pMessage.mb_str());
+ char* tmpbuf = wxStrdup(pMessage.mb_str());
int msgsize = strlen(tmpbuf);
char* buf = CreateBuffer(&msgsize);
memset(buf+2,0x0,msgsize);
//wxLogMessage(wxT("EventWorker: got connection"));
wxLogMessage(wxT("%s: starting writing message (2 bytes for signature and %d bytes of data to write)"),CreateIdent(m_localaddr).c_str(),m_outsize-2);
if (!m_clientSocket->GetLocal(m_localaddr))
+ {
wxLogError(_("Cannot get peer data for socket %p"),m_clientSocket);
+ }
m_currentType = WorkerEvent::SENDING;
wxLogDebug(wxT("%s: CONNECTING"),CreateIdent(m_localaddr).c_str());
SendEvent(false);