We don't really find, almost ...

xiaoxiao2021-03-06  49

Learn at least a new language every year. Different languages ​​solve the same problem in different ways. By learning a number of different ways, you can help you broaden your thinking and avoid ink. In addition, now many languages ​​have been prone to many, thanks to software wealth available from the Internet (see page 267).

l Read a technical book every quarter. The bookstore is full of books, discussing interesting topics related to your current project. Once you have developed habits, read a book for a month. After you master the technology you are using, the range is widened, read some books that have nothing to do with your project.

l Also read non-technical books. This is important to remember that the computer is human - you try to meet the needs of it needs. Don't forget the side of the characters.

l Class L. Local college or university, or will look for interesting courses next time.

l Participate in local user organizations. Don't just listen, and actively participate. It may be fatal with the world's absolute your career; what you are doing people outside your company.

l Test different environments. If you only work on Windows, you will play with UNIX at home (freely acquired Linux is justified). If you only use the makefile and editor, try the IDE and vice versa.

l Keep the trend. Subscribe to business magazines and other journals (see recommendation publications on page 262). Select the technology covered with different publications from your current project.

l Internet access. Want to know all kinds of new languages ​​or other technologies? To understand other people's related experience, understand the specific jars they use, and so on, the newsgroup is a good way. Internet surf, find papers, business sites, and any other source you can find.

Continuous investment is very important. Once you are familiar with a new language or new technology, continue. Learn another. //

Foreword In line with the shape of the email client software, we are not difficult to find that almost all of these software will send mail through the SMTP protocol and receive mail through the POP3 protocol. At the same time, most software implements TCP / IP connections by using the Winsock interface. Is it difficult to network programming with Winsock? Is the SMTP and POP3 protocols realized? In fact, it provides a WINSOCK control called Mswinsck.ocx in MICORSOFT Visual Basic 5.0. Through it, it does not need to be complex to Winsock..dll, and you don't need to buy expensive special Email controls. You can also Easy to write EMAIL client software based on SMTP protocol and POP3 protocol.

The first part of the Winsock Control Use Introduction When using the Winsock control, you first need to consider what protocol used. Microsoft's WINSOCK control can be used by TCP and UDP. The UDP protocol is a connectionless protocol. When writing Email software, a standard connected TCP / IP protocol is generally selected. That is, set its properties protocol to SCKTCPPROTOCOL. Other important properties used in the programming include: LocalPort local port number, listen to the listen port as a TCP connection, generally should be taken and standard ports (consider more than 1000), if you take 0 Each program boot will automatically allocate a port. The RemoteHost remote host name can be an IP address or a corresponding domain name RemotePort remote port, which is generally a standard port, SMTP is 25, and the POP3 is an important method for 110: Connect requires connection to remote computer SendData to send data to remote computer GetData When the DataArrival event appears, call the GetData method to get the data from the remote computer, and Close closes the client and server application to the important event for the TCP connection: DataArrival is when the new data from the remote server reaches the local machine The second part of the event writes the Email receiving software 1 based on the POP3 protocol. POP3 protocol POP3 (Post Office Protocol -Version 3) is a commonly used network protocol for collecting email from the mailbox of the remote server, and its common commands are: l authorization status according to the different states of the connection. : User Username Pass User Password Quit Exit L Execution Station: Stat Mailbox status, a few of the mailboxes Letter, total size (8 binary represented), etc. When the MSG parameter is used, the size list of each letter is displayed, with the MSG parameters, the length of the letter numbered MSG is displayed (8) Representation) TOP Take the letter of the letter (Head) and partial enrollment (body), n = 0, only the letterhead, N ≠ 0, Take the first N row of the letterhead and the letter. This command is an optional command, and some POP3 server software does not support. Retr Take the letter DELE of the Number MSG, deleting the number MSG, actually just a tag, actually deleting the update status L update status (Update State) Quit Exit, by deleting mail that DELE tagged, there is NOOP, LAST, RSET, RPOP and other commands, less usage.

2. Interface layout The applet is just to test the case of implementing the POP3 protocol receptive with the Winsock control, so the interface layout is relatively simple, using some text boxes to enter and display the information required. 3. The main programming is adding a Winsock control in Frame1, named Winsock1, the property protocol is set to SCKTCPPROTOCOL, and RemotePort is set to 110, and localport is set to 1001. I. Connecting the POP3 server Fill in the correct username, password, POP3 server name, press "Connection" button, perform the following instruction: private sub start_click () on error gotfailwinsock1.remotehost = SVRNAME.TEXT 'Setting the remote server IP or domain name winsock1.connect 'Connection Remote Server WAITI' Waiting WINSOCK1.SENDDATA "User" Acou.Text Chr (13) Chr (10) 'Send User Name Wain "Waiting to Answer Winsock1.senddata" Pass " passwd .Text Chr (13) CHR (10) 'Send User Password Waiting' Waiting to Answer Winsock1.sendData "Stat" CHR (13) CHR (10) 'Sub-mail Status Waiting' Waiting to Answer Winsock1.sendData "List" CHR (13) CHR (10) 'Letter Size List Waiting' Waiting for Answering End iFexit SubgetFail: Info.text = Info.text Chr (13) CHR (10) "Network Error!" CHR (13) CHR (10) Winsock1.close 'Close Winsock Connection End SubII. Receive the response of the POP3 server L Delayer WaitingPublic Sub Waiting () DIM PAUSETIME, STARTPAUSETIME = 60' Setting the longest time 60s waiting for the response time. 60s. START = Timer 'Set the start time. Do WHILE TIMER

III. Realization of the function of the letterhead, deletion, deletion, disconnection, etc. Private sub head_click () info.text = info.text chr (13) chr (10) "Number of sequence number" Num.Text "Letter of Letters CHR (13) CHR (10) Winsock1.sendData" TOP " Num.Text " 0 " CHR (13) CHR (10) WaitInd Subprivate Sub getm_click () Info.text = Info.text CHR (13) CHR (10) "Sequence Number" Num.Text "Letter content" CHR (13) CHR (10) Winsock1.senddata "Retr" Num.Text CHR (13) CHR (10) WaitInd Sub

Private sub DELM_CLICK () info.text = info.text chr (13) CHR (10) "Give the serial number" Num.Text "to delete the tag" CHR (13) CHR (10) Winsock1.senddata "dele" Num.Text chr (13) chr (10) WaitInd Sub

Private sub quitb_click () Winsock1.senddata "noop" chr (13) chr (10) Waitingwinsock1.senddata "quit" chr (13) chr (10) Waitingwinsock1.closend Sub

The third part writes the SMTP protocol-based email sending software that uses the Winsock control to edit POP3 recipient software, writing SMTP (SIMPLE MAIL TRANSFER Protocol) protocol is very simple. 1. The SMTP protocol SMTP has a total of 14 commands, but it is enough to send an email. It is enough to Helo in the POP3 server with the following 5 commands, transfer the local domain Mail from: Mailbox Name RCPT to: Transfer recipient's mailbox name DATA Send letter data (including letterhead and letter) Quit Exit the connection to the POP3 server

2. The interface layout is the same as the POP3 test program. The following applet is just to test the information of the SMTP protocol to implement the SMTP protocol with Winsock. Therefore, the interface layout is relatively simple, relying on some text boxes to enter and display the information required. The reader can find that the user name and password are not needed to fill in the user name and password here. This is because the SMTP server is not checking the user's identity, you can send a message from any SMTP server on the Internet, as long as it responds fast enough.

3. The main programming is added to the Frame1, which is called Winsock1. The property protocol is set to SCKTCPPROTOCOL, RemotePort is set to 25, and localport is set to 1002. Because all Winsock controls are used, the basic principles are the same, the latency of this test program WAITING subroutine and Winsock Accept data, Winsock1_DataArrival, etc., the same as POP3 Tester, this is not repeated. Fill in the SMTP server name correctly, the native domain name (if not, you can fill in the DEFAULT or other), the sender address of the letter, the recipient address, the title subject, and the content, press the send button, the program performs the following code: private subsend_click ) Answerf = FalseOn Error GoTo SendfailWinsock1.RemoteHost = Servername.Text 'disposed remote SMTP server domain name or IP Winsock1.Connect' SMTP connection to the remote server waiting 'waits for a response Winsock1.SendData "HELO" Frsvr.Text Chr (13) CHR (10) 'Handshake, send this domain name waitingwinsock1.senddata "Mail from:" fromxx.text chr (13) chr (10)' Send sender mailbox name waitingwinsock1.senddata "RCPT TO:" Toyy. Text chr (13) CHR (10) 'Sending the Name of the Receive Human Letter (This sentence can be repeated multiple times, realize the same letter to send to many people) WaitingWinsock1.senddata "Data" chr (13) CHR (10) 'Prepare to start transfer letter data waitingwinsock1.senddata "Subject:" Subj.Text chr (13) chr (10)' Send title Winsock1.senddata "reply-to:" fromxx.text chr (13) CHR (10) 'Send a reply address Winsock1.senddata "to:" Toyy.Text Chr (13) chr (10)' Send the receiving man's mailbox name, the mailbox name will appear in the Head of the letter (in the letterhead), If you want to send '(BCC), you don't send this Winsock1.senddata "X-MAILER: SMTP Tester" chr (13) chr (10)' to send the name of the mail software, you can freely name Winsock1.senddata Body. TEXT CHR (13) CHR (10) 'Send Letters WINSOCK1.SENDDATA CHR (13) CHR (10) "." Chr (13) chr (10) 'According to the protocol, "." The representative letter data is transmitted.

Waitingwinsock1.senddata "quit" chr (13) CHR (10) 'Disconnect WaitingInfo.text = info.text chr (13) chr (10) "Send end!" CHR (13) CHR (10) Winsock1.closeExit SubsendFail: info.text = info.text chr (13) chr (10) "Send failed!" CHR (13) chr (10) Winsock1.closeanswerf = falseeend SUB fourth part The program improvements and other uses of the Winsock control are just some basic methods developed by the VB5 Winsock control. To design a more practical Email software, it should also be written after the acquisition letter is written. To coding and decoding Chinese and accessories, enhances error capture, etc., I have a lot of places to improve, which is left to interested readers to practice. In addition, by changing the properties of the Winsock control, for example, it is changed to 21 (FTP), 23 (Telnet), according to the FTP or Telnet protocol, can also be designed with the Winsock control, limited to the space, I don't speak more here. . Welcome everyone and I will discuss the programming of Winsock control, my email is yangjie@poboxes.com, you need to have a full code of the above program, or contact me with the above mailbox. ------------------ End of this file -------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- author: Yang Jie unit: SUPCON automation Co., Ltd. address: Hangzhou Zhaohui six districts 73-1-502 Zip: 310014 Tel: (0571) 5132404EMAIL: yangjie @ mh. Hz.col.com.cn

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

New Post(0)