示例#1
0
int _tmain(int argc, _TCHAR* argv[])
{
    GSocket  kk;
    kk.Init("192.168.218.112",1556);
    kk.Run();
    return 0;
}
示例#2
0
void Mac_Socket_Callback(CFSocketRef s, CFSocketCallBackType callbackType,
                         CFDataRef address, const void* data, void* info)
{
  GSocket* socket = (GSocket*)info;
  struct MacGSocketData* macdata;
  macdata = (struct MacGSocketData*)socket->m_gui_dependent;
  if (!macdata) return;
  switch (callbackType)
  {
    case kCFSocketConnectCallBack:
      assert(!socket->m_server);
      // KH: If data is non-NULL, the connect failed, do not call Detected_Write,
      // which will only end up creating a spurious connect event because the
      // call to getsocketopt SO_ERROR inexplicably returns no error.
      // The change in behavior cannot be traced to any particular commit or
      // timeframe so I'm not sure what to think, but after so many hours,
      // this seems to address the issue and it's time to move on.
      if (data == NULL)
        socket->Detected_Write();
      break;
    case kCFSocketReadCallBack:
      socket->Detected_Read();
      break;
    case kCFSocketWriteCallBack:
      socket->Detected_Write();
      break;
    default:
      break;  /* We shouldn't get here. */
  }
}
示例#3
0
文件: gsockmot.cpp 项目: EdgarTx/wx
static void _GSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
                                  XtInputId *WXUNUSED(id))
{
    GSocket *socket = (GSocket *)data;

    socket->Detected_Write();
}
示例#4
0
/* Compatibility functions for GSocket */
GSocket *GSocket_new(void)
{
    GSocket *newsocket = new GSocket();
    if(newsocket->IsOk())
        return newsocket;
    delete newsocket;
    return NULL;
}
示例#5
0
static
void _GSocket_GDK_Input(gpointer data,
                        gint source,
                        GdkInputCondition condition)
{
  GSocket *socket = (GSocket *)data;

  if (condition & GDK_INPUT_READ)
    socket->Detected_Read();
  if (condition & GDK_INPUT_WRITE)
    socket->Detected_Write();
}
示例#6
0
void Mac_Socket_Callback(CFSocketRef s, CFSocketCallBackType callbackType,
                         CFDataRef address, const void* data, void* info)
{
  GSocket* socket = (GSocket*)info;
  struct MacGSocketData* macdata;
  macdata = (struct MacGSocketData*)socket->m_gui_dependent;
  if (!macdata) return;
  switch (callbackType)
  {
    case kCFSocketConnectCallBack:
      assert(!socket->m_server);
      socket->Detected_Write();
      break;
    case kCFSocketReadCallBack:
      socket->Detected_Read();
      break;
    case kCFSocketWriteCallBack:
      socket->Detected_Write();
      break;
    default:
      break;  /* We shouldn't get here. */
  }
}
示例#7
0
static void _GSocket_X11_Output(int *fid, void* data)
{
  GSocket *socket = (GSocket *)data;

  socket->Detected_Write();
}
示例#8
0
static void _GSocket_X11_Input(int *fid, void* data)
{
  GSocket *socket = (GSocket *)data;
  
  socket->Detected_Read();
}
示例#9
0
static void _GSocket_PM_Output(void *data)
{
    GSocket *socket = (GSocket *) data;
    socket->Detected_Write();
}
示例#10
0
static void _GSocket_PM_Input(void *data)
{
    GSocket *socket = (GSocket *) data;
    socket->Detected_Read();
}