Merge pull request #10 from MasterCna/master

added initializer for example
This commit is contained in:
Kirigaya Kazuto 2021-12-18 17:36:28 +08:00 committed by GitHub
commit 0b13918bc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,10 @@ int main()
{ {
int ret; int ret;
std::string ip; std::string ip;
// Initiate Socket Handler
InitNativeSocket();
if ((ret = DNSResolve("kiritow.com", ip)) < 0) if ((ret = DNSResolve("kiritow.com", ip)) < 0)
{ {
printf("Failed to resolve ip address. (%d)\n", ret); printf("Failed to resolve ip address. (%d)\n", ret);
@ -72,6 +76,10 @@ void service_main(sock& s)
int main() int main()
{ {
// Initiate Socket Handler
InitNativeSocket();
serversock t; serversock t;
if (t.bind(59123) < 0 || t.listen(10) < 0) if (t.bind(59123) < 0 || t.listen(10) < 0)
{ {