class wxSocketState : public wxObject {
public:
- bool notify_state;
+ bool notify_state;
GSocketEventFlags evt_notify_state;
wxSocketBase::wxSockFlags socket_flags;
wxSocketBase::wxSockCbk c_callback;
bool wxSocketBase::Close()
{
- if (m_socket)
+ if (m_socket)
{
if (m_notify_state == TRUE)
Notify(FALSE);
old_event_flags = NeededReq();
old_notify_state = m_notify_state;
-
+
SetNotify(GSOCK_INPUT_FLAG | GSOCK_LOST_FLAG);
Notify(TRUE);
SaveState();
SetFlags(NOWAIT | SPEED);
- while (recv_size == MAX_BUFSIZE)
+ while (recv_size == MAX_BUFSIZE)
{
recv_size = Read(my_data, MAX_BUFSIZE).LastCount();
}
GSocketEventFlags wxSocketBase::EventToNotify(GSocketEvent evt)
{
- switch (evt)
+ switch (evt)
{
case GSOCK_INPUT:
return GSOCK_INPUT_FLAG;
return GSOCK_OUTPUT_FLAG;
case GSOCK_CONNECTION:
return GSOCK_CONNECTION_FLAG;
- case GSOCK_LOST_FLAG:
+ case GSOCK_LOST:
return GSOCK_LOST_FLAG;
default:
return 0;
m_unread = tmp;
}
-
+
m_unrd_size += size;
memcpy(m_unread, buffer, size);
void wxSocketClient::OnRequest(GSocketEvent evt)
{
- if (evt == GSOCK_CONNECTION)
+ if (evt == GSOCK_CONNECTION)
{
- if (m_connected)
+ if (m_connected)
{
m_neededreq &= ~GSOCK_CONNECTION_FLAG;
return;
event->m_socket = m_socket;
}
+// --------------------------------------------------------------------------
+// wxSocketModule
+// --------------------------------------------------------------------------
+class WXDLLEXPORT wxSocketModule: public wxModule {
+ DECLARE_DYNAMIC_CLASS(wxSocketModule)
+ public:
+ bool OnInit() {
+ GSocket_Init();
+ return TRUE;
+ }
+ void OnExit() {
+ GSocket_Done();
+ }
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxSocketModule, wxModule)
+
#endif
// wxUSE_SOCKETS