aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/org/traccar/server/SocketCliente.java44
1 files changed, 44 insertions, 0 deletions
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) {
+ }
+
+ }
+
+ }
+
+}