//
// sub_18010A160 from 0x18010a160 to 0x18010a244 (228 bytes)
//
// 2 xrefs:
// > sub_1800DA550 @ 0x1800da5a2
// > ??> @ 0x18020179c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_18010A160(u_short a1, __int64 a2, SOCKET *a3)
{
SOCKET v5; // rax
SOCKET v6; // rbx
unsigned int v7; // edi
struct sockaddr name; // [rsp+20h] [rbp-48h] BYREF
v5 = socket(2, 1, 0);
v6 = v5;
if ( v5 == -1 )
{
LABEL_6:
v7 = 43;
goto LABEL_7;
}
v7 = sub_18010A300(v5);
if ( !v7 )
{
*(_QWORD *)&name.sa_data[6] = 0;
name.sa_family = 2;
*(_WORD *)name.sa_data = htons(a1);
*(_DWORD *)&name.sa_data[2] = htonl(0);
if ( bind(v6, &name, 16) == -1 )
{
WSAGetLastError();
}
else if ( listen(v6, 3) != -1 )
{
*a3 = v6;
return 0;
}
goto LABEL_6;
}
LABEL_7:
if ( v6 != -1 )
closesocket(v6);
return v7;
}