MCPcopy Create free account
hub / github.com/caozhiyi/CppNet / SyncConnection

Method SyncConnection

net/win/SocketImpl.cpp:85–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85void CSocketImpl::SyncConnection(const std::string& ip, uint16_t port, const char* buf, uint32_t buf_len) {
86 if (ip.length() > 16 || ip.empty()) {
87 base::LOG_ERROR("a wrong ip! ip : %s", ip.c_str());
88 return;
89 }
90
91 if (!_read_event->_client_socket) {
92 _read_event->_client_socket = memshared_from_this();
93 }
94
95 // set address info
96 strcpy(_ip, ip.c_str());
97 _port = port;
98
99 if (_event_actions) {
100 _read_event->_event_flag_set = 0;
101 _read_event->_event_flag_set |= EVENT_CONNECT;
102 if (_event_actions->AddConnection(_read_event, ip, port, buf, buf_len)) {
103 _post_event_num++;
104 }
105 }
106}
107
108void CSocketImpl::SyncConnection(const std::string& ip, uint16_t port) {
109 SyncConnection(ip, port, nullptr, 0);

Callers 1

ConnectionMethod · 0.45

Calls 1

AddConnectionMethod · 0.45

Tested by

no test coverage detected