java socket email ÎÊÌâ - Java / Java SE
ÎÒÔÚ javaºËÐļ¼ÊõÉÏ ¿´ÁËÒ»¸ö ÀûÓà Java socket emailµÄÀý×Ó ¿ÉÊÇÔõôҲ ²»³É¹¦ Ϊʲô£¿
Ô´Âë
Java code:
package cn.com.test.email;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.util.Scanner;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class MailTest {
public static void main(String[] args) {
JFrame frame = new MailTestFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
@SuppressWarnings("serial")
class MailTestFrame extends JFrame {
private Scanner in;
private PrintWriter out;
private JTextField from;
private JTextField to;
private JTextField smtpServer;
private JTextArea message;
private JTextArea comm;
public static final int DEFAULT_WIDTH = 300;
public static final int DEFAULT_HEIGHT = 300;
public MailTestFrame() {
setSize(DEFAULT_WIDTH,DEFAULT_HEIGHT);
setTitle(
Ïà¹ØÎÊ´ð£º
ÎÒ¶¨ÒåÁËÒ»¸öJRadioButtonNanµÄµ¥Ñ¡°´Å¥£¬Èç¹ûÔÚÎÒÑ¡ÔñÁËÕâ¸ö°´Å¥ºóÏëµã»÷ÖØÖÃÈÃÕâ¸ö°´Å¥´¦ÓÚδѡÔñµÄ״̬¸ÃÔõô×öÄØ£¿Çë¸ßÊÖÖ¸½Ì
jRadioButton.setSelected(false);
²»ÖªµÀÄãÊÇʲôÒâ˼
Õâ¸öÊDz»Ñ¡Ôñ״̬ÁË
Î ......
±¾ÈËÕýÔÚÓÃJava×öÒ»¸öC/S¼Ü¹¹µÄÏîÄ¿£¬
¿ÉÊÇÓÉÓÚÏîÄ¿±È½Ï´ó£¬Ç°ÆڶԼܹ¹µÄÉè¼ÆÓÈÆäÖØÒª£¬ÒòΪºóÆÚ¿ÉÄÜËæʱ»á¼Ó¸ö¹¦ÄÜ»òÕßÈ¥µôijЩ¹¦ÄÜ¡£
ËùÒÔÌصØÑ°ÇóÈçºÎÉè¼ÆC/SµÄ¼Ü¹¹Ê¹³ÌÐò¸ü¼ÓÃæÏò¶ÔÏó¸ü¼ÓÒ×ÓÚά ......
´úÂëÈçÏ £¬ÎÒÏëͨ¹ý´úÀí·ÃÎÊһЩÍøÖ·£¬µ«ÊDz»ÖªµÀÈçºÎ²âÊÔ´úÀí³É¹¦£¬ÎÒÏëͨ¹ý·ÃÎÊ¡°http://www.blogger.com/¡±À´¿´¿´ÊÇ·ñ´úÀí³É¹¦£¬µ«ÊÇÒ²²»ÄÜ·ÃÎÊ£¬³öÏÖÒì³£¡°Unexpected end of file from server¡±£¬µ«ÊÇÈç¹û²»Õâ ......
ÒªÇóÊÇÊäÈëÒ»¸öÊý×Ö£¬È»ºó°´ÕÕÏÂÃæµÄ·½Ê½Êä³ö£¨Ë³Ê±ÕëÐýת£©
±ÈÈç ÊäÈë 2
ÔòÊä³öΪ
1 2 3
8 9 4
7 6 5
ÊäÈë 6
ÔòÊä³öΪ
1 2 3 4 5 6
20 21 22 23 24 7
19 32 33 34 25 8
18 31 36 ......