ntohs

ntohsは、ネットワークバイトオーダなポート番号などを、ホストバイトオーダの値に変換するWindowsAPI・・・。

ntohs function (Windows)

UNIX系OSのntohsと同様の使い方・・・。

これで相手側のポートを出力してみる・・・。

WSAStartup success!
soc = 124
port = 0fa0, ns_port = a00f
setsockopt(SO_REUSEADDR) success.
bind Success.
listen success.
acc = 128
accept!(IPAddress = 127.0.0.1, Port = 53151)
続行するには何かキーを押してください . . .

今度は、相手側は53151番のポートを使っているみたい・・・。

Sample/ntohs.cpp at master · bg1bgst333/Sample · GitHub