int Socket::connect(struct sockaddr *sa, socklen_t salen) { if (bindsocket() == -1) return -1; if (!utp_sock) { utp_sock = UTP_Create(_SendToProc, this, sa, salen); UTP_SetCallbacks(utp_sock, &utp_funcs, this); } UTP_Connect(utp_sock); }
void CUTPSocketSession::Connect(const struct sockaddr *sa, socklen_t sa_len) { ASSERT(!IsValid()); m_Socket = UTP_Create(&send_to, GetParent<CUTPSocketListner>(), sa, sa_len, &utp_overhead_2); //UTP_SetSockopt(m_Socket, SO_SNDBUF, 100*300); UTPFunctionTable utp_callbacks = {&utp_read, &utp_write, &utp_get_rb_size, &utp_state, &utp_error, &utp_overhead}; UTP_SetCallbacks(m_Socket, &utp_callbacks, this); UTP_Connect(m_Socket); }