Untitled

 avatar
unknown
plain_text
4 years ago
1.1 kB
3
Indexable
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package echo;
import java.net.*;
import java.io.*;

/**
 *
 * @author nguye
 */
public class Ex911 {
    public static void main(String[] args) throws IOException{
        String hostName;
        hostName = "203.162.10.109";
        int portNumber = 2207;
        
        try{
            Socket Client = new Socket(hostName, portNumber);
            Client.getOutputStream();
            
            DataOutputStream dos = new DataOutputStream(Client.getOutputStream());
            dos.writeUTF("B18DCAT204;911");
            
            DataInputStream dis = new DataInputStream(Client.getInputStream());
            
            int a = dis.readInt();
            
        
            dos.writeInt(a);
            
            dis.close();
            dos.close();
            
            Client.close();
        }catch(IOException e){
            System.out.println(e);
        }
    }
    
}


Editor is loading...