Write a network pager with VB (1)

zhaozj2021-02-08  264

When you mention the big name of ICQ, friends who love computer will not feel strangers? ICQ is the page player on the Internet. Whenever your friend is online, you only need to enter his ID number in ICQ, you can call him on the Internet. Due to its convenient, fast, and has many registered users, ICQ has become the most popular network pager on the Internet. It is almost necessary for each Internet user. When you use ICQ, will you think about writing a network pager yourself? This can be implemented in VB. The principle of the network paging is when the client program is connected to the server, search the ID number of the required call via the server, if this user is detected, the server is in the networked state, the server notifies the user's client program response called party customer Diffuses, and then after the calling party and the called party are established, both sides can chat or do other communications. Writing a network pager in VB requires two programs, one for the client program client, one for the server server server. First, establish a form in the Client project, load the Winsock control, called TCPClient, and the protocol selection TCP. Add four text boxes to enter the server's IP address, server port number, and call the network paging ID number and the user login ID number. Then add three buttons in the form, name "Connect", "Disconnect", "Out", click the "Connect" button, and perform the following initialization connection, the code is as follows: private submmand1_click () if LEN TEXT1.TEXT) = 0 and LEN (Text2.Text) = 0 THEN MSGBOX ("Please enter the host name or host IP address.") Exit Sub elseif len (text1.text)> 0 TCPCLIENT.Remotehost = Text1.Text TcpClient .RemotePort = Text2.Text End If tcpClient.Connect Timer1.Enabled = True End Sub Private Sub Command2_Click () tcpClient.Close 'disconnect End Sub Private Sub Command3_Click () End End Sub Private Sub Form_Load () Text2.Text = " 1001 "End Sub Private Sub tcpClient_Connect () tcpClient.SendData (Text3.Text &" @ "& Text4.Text) End Sub Private Sub tcpClient_DataArrival (ByVal bytesTotal As Long) Dim strData As String tcpClient.GetData strData strData = strData " call " ' When you receive a call message, pop up a dialog box and display the calling party ID number msgbox (strData) end sub

转载请注明原文地址:https://www.9cbs.com/read-1499.html

New Post(0)