Joke Collection Website - Cold jokes - Flying pigeon book software Flying pigeon book software can chat on LAN. How is it achieved? If there is a little? Implementation code.
Flying pigeon book software Flying pigeon book software can chat on LAN. How is it achieved? If there is a little? Implementation code.
void EM _ UserLogin::SendLogin _ BC(LPEM _ DATA msg)
{
SOCKET m _ socket
m_socket = socket(AF_INET,SOCK_DGRAM,IP proto _ IP);
If (invalid socket == m socket)
{
MessageBox(0, "Socket failed." ,NULL,MB _ OK);
}
SOCKADDR _ IN sinsin . sin _ addr . s _ addr = htonl(in addr _ BROADCAST);
sin.sin _ family = AF _ INET
sin . sin _ PORT = htons(BROADCAST _ SEND _ PORT); BOOL bOpt = TRUE
if(SOCKET _ ERROR = = setsockopt(m _ SOCKET,SOL_SOCKET,SO_BROADCAST,(char *)& amp; bOpt,sizeof(bOpt)))
{
//An error occurred
* MessageBox(0, "BC setsockopt error." ,0,0);
Return;
}
char * tmpBuf = msg-& gt; get buffer();
if(SOCKET _ ERROR = = send to(m _ SOCKET,tmpBuf,msg-& gt; GetLength(),0,(PSOCKADDR)& amp; sin,sizeof(sin)))
{
//An error occurred
* MessageBox(0, "BC sent to error." ,0,0);
Return;
} close socket(m _ socket);
} We should keep up with QQ, MSN, ICQ, AIM and other large-scale instant messaging. Compared with them, XEIM is just a poor student in the class. If we want to catch up with these excellent students, only by making greater efforts can we catch up with or even surpass them. However, if you do nothing, it will become a joke. The principle of flying pigeon delivering books: (1) The most important thing is the establishment of LAN user list; When the flying pigeon starts, it uses UDP protocol to send broadcast packets to the broadcast address 255.255.255.255, and the default port is 2425. The broadcast package contains user name, workgroup, host name, IP and other information;
After receiving this broadcast packet through port 2425, the user who has started flying pigeon will add the user name, workgroup and other information to his user list, and send the personal information of the local user to the other IP; So that both parties can establish a user list; (2) The broadcast packet sent when refreshing the user list is similar to that at startup, but the returned identification information is slightly different; Can be a small tool to monitor the memory flow of port 2425, which can intercept messages when refreshing and chatting. (3) UDP protocol is also used when transmitting chat information; Because UDP is a connectionless protocol, the transmission speed is fast, but there is no confirmation mechanism, which is an unreliable protocol. You need to define the sign of returning information to judge whether the other party has received the information. (4) When the user is offline, send an offline broadcast packet to 255.255.255.255, and the user who receives this broadcast packet will delete the other party's user list information according to the IP address in the packet (which may also include various judgment marks or hardware marks, such as network card address, etc.). );
(5) WAN can't directly use broadcast mode, but manually add "off-network broadcast list" to establish mutual relationship; (6) Flying pigeons use TCP protocol to transmit files, port 2425; Other information: 1. Flying pigeon uses C++ language, and the development tool: Visual C++4. 1, 6.0, or higher version; 2. Flying pigeons are open source. Download the source code from the websites of the author (Zhang Kai Shiraishi from Hiroshima, Japan) and the Sinicizer (A Zhi). The source code is marked in Japanese; You can modify the compilation with VC++; 3. Flying pigeon biography is a software from Japan, and the Japanese version is its first version; There are also Chinese, English, Korean, Portuguese and other languages; 4. Encryption algorithms used by flying pigeons: RSA, Blowfish, RC; 5. Flying pigeons can send messages through the command line. The command format is as follows: ipmsg [port]/msg [/log] [/seal]; < message > you can change the default port by using the IPMsg [Port] command, and start multiple instances at the same time, but only users who use the same port can receive interactive information after modification; 6. The non-installed version of Flying Pigeon is not a purely portable application. Deleting directly will leave junk key values in the registry; * Flying Pigeon saves all setting information in the following location in the registry: \ \ HKEY _ Current _ User \ Software \ hstools \ User password is stored in an irreversible encryption way. * If you forget the password, you can delete this key value in the registry and clear the password * \ \ HKEY _ Current _ User \ Software \ Hstools \ ipmseng \ passwordstr 7. When the number of files transmitted by flying pigeons reaches several thousand at a time, it is possible to lose files, which is suspected to be a bug of flying pigeons, but there is no problem in transmitting large files; 8. The most stable official version of flying pigeon is V2.06;; At present, version v2.50 alpha6 is being tested and has not been officially released; Others, such as 2.7 1, the 2007 green version is a modified version, not a genuine one;
- Related articles
- The composition of Tai Po Spring Festival is over 500 words.
- Ask for a super funny comedy script
- Especially funny QQ space to talk about sentences.
- 20 10 find funny jokes short, but be sure to laugh.
- Brave heart 62-76 story introduction
- Black and yellow jokes
- What is the scariest movie you have ever seen?
- Wherever American weapons go, they are trouble. "
- Who can introduce me to some American science fiction blockbusters?
- Invincible Destroyer 2 is hilarious and touching. What are its impressive details?