virtual wxSocketImpl *WaitConnection(wxSocketBase& wxsocket);
- int Read(char *buffer, int size);
- int Write(const char *buffer, int size);
+ int Read(void *buffer, int size);
+ int Write(const void *buffer, int size);
private:
virtual wxSocketError DoHandleConnect(int ret);
wxSocketError Input_Timeout();
wxSocketError Output_Timeout();
wxSocketError Connect_Timeout();
- int Recv_Stream(char *buffer, int size);
- int Recv_Dgram(char *buffer, int size);
- int Send_Stream(const char *buffer, int size);
- int Send_Dgram(const char *buffer, int size);
+ int Recv_Stream(void *buffer, int size);
+ int Recv_Dgram(void *buffer, int size);
+ int Send_Stream(const void *buffer, int size);
+ int Send_Dgram(const void *buffer, int size);
int m_msgnumber;
// IO operations
// -------------
- virtual int Read(char *buffer, int size) = 0;
- virtual int Write(const char *buffer, int size) = 0;
+ virtual int Read(void *buffer, int size) = 0;
+ virtual int Write(const void *buffer, int size) = 0;
wxSocketEventFlags Select(wxSocketEventFlags flags);
virtual void Shutdown();
virtual wxSocketImpl *WaitConnection(wxSocketBase& wxsocket);
- int Read(char *buffer, int size);
- int Write(const char *buffer, int size);
+ int Read(void *buffer, int size);
+ int Write(const void *buffer, int size);
//attach or detach from main loop
void Notify(bool flag);
wxSocketError Input_Timeout();
wxSocketError Output_Timeout();
- int Recv_Stream(char *buffer, int size);
- int Recv_Dgram(char *buffer, int size);
- int Send_Stream(const char *buffer, int size);
- int Send_Dgram(const char *buffer, int size);
+ int Recv_Stream(void *buffer, int size);
+ int Recv_Dgram(void *buffer, int size);
+ int Send_Stream(const void *buffer, int size);
+ int Send_Dgram(const void *buffer, int size);
protected:
/* Generic IO */
/* Like recv(), send(), ... */
-int wxSocketImplMSW::Read(char *buffer, int size)
+int wxSocketImplMSW::Read(void *buffer, int size)
{
int ret;
return ret;
}
-int wxSocketImplMSW::Write(const char *buffer, int size)
+int wxSocketImplMSW::Write(const void *buffer, int size)
{
int ret;
return wxSOCKET_NOERROR;
}
-int wxSocketImplMSW::Recv_Stream(char *buffer, int size)
+int wxSocketImplMSW::Recv_Stream(void *buffer, int size)
{
- return recv(m_fd, buffer, size, 0);
+ return recv(m_fd, static_cast<char *>(buffer), size, 0);
}
-int wxSocketImplMSW::Recv_Dgram(char *buffer, int size)
+int wxSocketImplMSW::Recv_Dgram(void *buffer, int size)
{
wxSockAddr from;
WX_SOCKLEN_T fromlen = sizeof(from);
int ret;
wxSocketError err;
- ret = recvfrom(m_fd, buffer, size, 0, (sockaddr*)&from, &fromlen);
+ ret = recvfrom(m_fd, static_cast<char *>(buffer),
+ size, 0, &from, &fromlen);
if (ret == SOCKET_ERROR)
return SOCKET_ERROR;
return ret;
}
-int wxSocketImplMSW::Send_Stream(const char *buffer, int size)
+int wxSocketImplMSW::Send_Stream(const void *buffer, int size)
{
- return send(m_fd, buffer, size, 0);
+ return send(m_fd, static_cast<const char *>(buffer), size, 0);
}
-int wxSocketImplMSW::Send_Dgram(const char *buffer, int size)
+int wxSocketImplMSW::Send_Dgram(const void *buffer, int size)
{
struct sockaddr *addr;
int len, ret;
return -1;
}
- ret = sendto(m_fd, buffer, size, 0, addr, len);
+ ret = sendto(m_fd, static_cast<const char *>(buffer), size, 0, addr, len);
/* Frees memory allocated by _GAddress_translate_to */
free(addr);
/* Generic IO */
/* Like recv(), send(), ... */
-int wxSocketImplUnix::Read(char *buffer, int size)
+int wxSocketImplUnix::Read(void *buffer, int size)
{
int ret;
return ret;
}
-int wxSocketImplUnix::Write(const char *buffer, int size)
+int wxSocketImplUnix::Write(const void *buffer, int size)
{
int ret;
return wxSOCKET_NOERROR;
}
-int wxSocketImplUnix::Recv_Stream(char *buffer, int size)
+int wxSocketImplUnix::Recv_Stream(void *buffer, int size)
{
int ret;
do
return ret;
}
-int wxSocketImplUnix::Recv_Dgram(char *buffer, int size)
+int wxSocketImplUnix::Recv_Dgram(void *buffer, int size)
{
wxSockAddr from;
WX_SOCKLEN_T fromlen = sizeof(from);
return ret;
}
-int wxSocketImplUnix::Send_Stream(const char *buffer, int size)
+int wxSocketImplUnix::Send_Stream(const void *buffer, int size)
{
int ret;
do
{
- ret = send(m_fd, (char *)buffer, size, GSOCKET_MSG_NOSIGNAL);
+ ret = send(m_fd, buffer, size, GSOCKET_MSG_NOSIGNAL);
}
while (ret == -1 && errno == EINTR); /* Loop until not interrupted */
return ret;
}
-int wxSocketImplUnix::Send_Dgram(const char *buffer, int size)
+int wxSocketImplUnix::Send_Dgram(const void *buffer, int size)
{
struct sockaddr *addr;
int len, ret;
do
{
- ret = sendto(m_fd, (char *)buffer, size, 0, addr, len);
+ ret = sendto(m_fd, buffer, size, 0, addr, len);
}
while (ret == -1 && errno == EINTR); /* Loop until not interrupted */