views:

40

answers:

2

Hello everybody.

I'm looking for something,I don't know if it exists.

I have a Java server, something like

while (true) {
            try {
                Socket socket = server.accept();
                new ConnectionHandler(socket);
                System.out.println("Waiting for a new client message...");
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

What I need, is to do a unix client to connect to this server. I need only to send a message, and my server will launch a process. Is there a way to build a unix client ?

Thanks alot.

+1  A: 
  • At least for testing, you could use telnet to connect to your service, and issue text commands.

  • Netcat could be used as well, just give it the IP address and port where your Java server is running. e.g.

    echo "My Message" | nc 192.168.1.42 10001

  • Build your own client in Java.

nos
I don't want a Java client. That's the thing.
CC
Ok, then go with any of the first 2 options, or explain further what you actually want(e.g. do you want to build your own client, in C, C++,Python, something else ?)
nos
Actually, I would like to know if there is something native to do that. If no, I will build my own java client.
CC
A: 

If you don't want to develop a client in Java you could consider the unix nc (netcat) command. It's a veritable swiss-army knife of TCP and UDP.

bjg