TCP<Client side>

2014. 6. 29. 16:58Programming/Java

반응형

class ConnectThread extends Thread {

    String sendMsg;

    

    public ConnectThread(String msg) {

    sendMsg = msg;

    }

    

    public void run() {


    try {


    Socket sock = new Socket(ipAddr, port);

    ObjectOutputStream outstream = new ObjectOutputStream(sock.getOutputStream());

    outstream.writeObject(sendMsg);

    outstream.flush();

    

    sock.close();


    } catch(Exception ex) {

    ex.printStackTrace();

    }

    }

    }

반응형

'Programming > Java' 카테고리의 다른 글

Java로 RaspberryPi I2C 사용하기  (0) 2014.08.11
Java로 RaspberryPi GPIO 제어하기!(CODE section)  (0) 2014.07.20
TCP<Server side>  (0) 2014.06.29
UDP<Client side>  (0) 2014.06.29
UDP<Server side>  (0) 2014.06.29