001    package org.protocol;
002    
003    import java.util.*;
004    import java.io.*;
005    import java.net.*;
006    import java.awt.*;
007    import java.awt.event.*;
008    import javax.swing.*;
009    import javax.swing.event.*;
010    
011    public class SimpleUDPServerSocket {
012    
013            private InputStream in_;
014            private OutputStream out_;
015            private DatagramPacket packet_;
016            private DatagramSocket socket_;
017            private String server_;
018            private int port_;
019            private int timeout_;
020            private int buf_size_;
021            private boolean is_server_mode_;
022    
023            public SimpleUDPServerSocket(int port, int timeout, int buf_size) {
024                    is_server_mode_ = false;
025                    server_ = null;
026                    port_ = port;
027                    timeout_ = timeout;
028                    buf_size_ = buf_size;
029            }
030    
031            public void init() throws Exception {
032                    byte[] buf_ = new byte[buf_size_];
033                    packet_ = new DatagramPacket(buf_, buf_.length, new InetSocketAddress(server_, port_));
034                    socket_ = new DatagramSocket();
035    
036                    
037            }
038            public InputStream getInputStream() {
039                    return in_;
040            }
041            public OutputStream getOutputStream() {
042                    return out_;
043            }
044    
045            public static void main(String[] args) {
046                    
047            }
048    
049            public static void alert(Object message) {
050                    System.out.println(message);
051                    // javax.swing.JOptionPane.showMessageDialog(null, message);
052            }
053    }