netbasic.cpp
来自「用UDP写的可靠传输,非常有借鉴意义,适合互连网通讯」· C++ 代码 · 共 33 行
CPP
33 行
// IPAddr represents workstations network address
// NetSender - Interface for network sending provider
// NetReceiver - Interface for network receiving provider
// Implementation file
//
// (c) Lev Naumov, CAMEL Laboratory
// E-mail: camellab@mail.ru
// For more information see http://camel.ifmo.ru or
// http://www.codeproject.com/internet/ctp.asp
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "NetBasic.h"
bool IPAddr::FromString(LPTSTR s)
{
Bytes.b1=(unsigned char)atoi(s);
s=strchr(s,'.');
if (!s) {SetLocalhost(); return false;}
s++;
Bytes.b2=(unsigned char)atoi(s);
s=strchr(s,'.');
if (!s) {SetLocalhost(); return false;}
s++;
Bytes.b3=(unsigned char)atoi(s);
s=strchr(s,'.');
if (!s) {SetLocalhost(); return false;}
s++;
Bytes.b4=(unsigned char)atoi(s);
return true;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?