From b11ff82a003b828dbaecc564c54d447440249701 Mon Sep 17 00:00:00 2001 From: williamchitto Date: Tue, 31 Jul 2012 12:00:03 -0300 Subject: Added socket client --- test/org/traccar/server/SocketCliente.java | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 test/org/traccar/server/SocketCliente.java diff --git a/test/org/traccar/server/SocketCliente.java b/test/org/traccar/server/SocketCliente.java new file mode 100644 index 000000000..c26c02e49 --- /dev/null +++ b/test/org/traccar/server/SocketCliente.java @@ -0,0 +1,44 @@ +package org.traccar.server; + +import java.io.IOException; +import java.io.PrintStream; +import java.net.Socket; + +public class SocketCliente { + + /** + * @param args + */ + public void SendMSG(String url, int port, String msg) { + + Socket s = null; + + PrintStream ps = null; + + try { + + s = new Socket(url, port); + + ps = new PrintStream(s.getOutputStream()); + + ps.println(msg); + + System.out.println("send"); + + } catch (IOException e) { + + System.out + .println("Some problem happened on send data to socket."); + + } finally { + + try { + s.close(); + } catch (IOException e) { + } + + } + + } + +} -- cgit v1.2.3