MCPcopy Create free account
hub / github.com/F-Stack/f-stack / CreateSocket

Method CreateSocket

adapter/micro_thread/mt_connection.cpp:77–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77int UdpShortConn::CreateSocket()
78{
79 _osfd = socket(AF_INET, SOCK_DGRAM, 0);
80 if (_osfd < 0)
81 {
82 MTLOG_ERROR("socket create failed, errno %d(%s)", errno, strerror(errno));
83 return -1;
84 }
85
86 int flags = 1;
87 if (ioctl(_osfd, FIONBIO, &flags) < 0)
88 {
89 MTLOG_ERROR("socket unblock failed, errno %d(%s)", errno, strerror(errno));
90 close(_osfd);
91 _osfd = -1;
92 return -2;
93 }
94
95 if (_ntfy_obj) {
96 _ntfy_obj->SetOsfd(_osfd);
97 }
98
99 return _osfd;
100}
101
102int UdpShortConn::CloseSocket()
103{

Callers

nothing calls this directly

Calls 8

SetOsfdMethod · 0.80
DisableOutputMethod · 0.80
EnableInputMethod · 0.80
GetRealNtfyObjMethod · 0.80
GetOsfdMethod · 0.80
socketFunction · 0.70
ioctlFunction · 0.70
closeFunction · 0.70

Tested by

no test coverage detected