Socket
文章平均质量分 82
sooner01
work hard, play hard
展开
-
Basic way to get local IP
The function is as follow:BOOL getLocalIP(CString &cstrIP){ char strHostname[MAX_PATH] = {0}; hostent* pHost = NULL; if (SOCKET_ERROR == gethostname(strHostname, sizeof(strHostna原创 2008-07-15 21:14:00 · 497 阅读 · 0 评论 -
about select()
usages of selecta) test the socket statusb) Set interval time, a way of timeout control.Prototype:int select( int nfds, fd_set FAR *readfds,原创 2008-08-02 10:59:00 · 998 阅读 · 0 评论 -
Some basic socket functions
1. WSAStartup(), WSACleanup()int PASCAL WSAStartup(WORD,LPWSADATA);int PASCAL WSACleanup(void);You should only need to call these functions once each, the former when you initialize Winsock原创 2008-08-02 10:13:00 · 477 阅读 · 0 评论 -
Two ways to terminate blocking socket thread gracefully
When writing the socket program with blocking socket functions, in most cases you need to start a thread to accept connection or write and read data. Here are basic ways to end a thread: 1,原创 2008-08-19 14:11:00 · 1021 阅读 · 0 评论 -
BIO socket summary
Undoubtedly socket BIO is a splendid socket interface implemented in C language, to some extent it have Object Oriented Programming thinking in C language, and provides more OS compatibility. Well原创 2008-09-19 14:52:00 · 720 阅读 · 0 评论 -
Speed control in network
Under some circumstances you need to control the speed of sending or receiving data in network. The speed of network is always measured by kbps, which means how many bits to send within one second.原创 2008-10-27 17:27:00 · 574 阅读 · 0 评论 -
Enumerate the network adaptor in system
Just use GetAdaptersInfo() defined in iphlpapi.h, Link to Iphlpapi.lib.In the struct IP_ADAPTER_INFO you may get adaptor’s MAC, IPv4 addresses, gateways, and secondary WINS servers and so on. The Ad原创 2008-11-28 15:53:00 · 513 阅读 · 0 评论