Jump to content
Sign in to follow this  

Communicating with java (possible)?

Recommended Posts


Hey not sure just how advanced this is, but I thought it would be a cool idea to have a java server, autoIT client.

I'm having no difficulty connecting, I can tell there is a connection, but my java code stops at line 40, msg = inStream.readLine();

Is there going to be compatibility issues between the messages autoIT is sending and the ones java is expecting to receive?

autoIT client:

$c_Ip = ""
$c_Port = 6424


$socket = TCPConnect($c_Ip, $c_Port)

if $socket = -1 Then
    msgbox(0, "Error", "Error Connecting")

while True
    $msg = inputbox("Send msg", "Send msg to server")
    TCPSend($socket, $msg)

Java server:

import java.net.*;
import javax.swing.*;
import java.io.*;
import java.util.*;
import java.awt.*;
import java.io.BufferedReader;

public class Server {
    public Server() {
    public static void main(String[] args) {
        final int port = 6424;
        Socket clientsocket = null;
        ServerSocket sSocket = null;
        BufferedReader in = null;
        InputStream ins = null;
        BufferedReader inStream = null;
        String msg = "";
            sSocket = new ServerSocket(port);
        }catch(IOException e){
            System.out.println("Error: " + e);
        System.out.println("Starting server..");
            clientsocket = sSocket.accept();
        }catch(IOException e){
            System.out.println("Error: " + e);
        System.out.println("Connection detected!");
            ins = clientsocket.getInputStream();
            InputStreamReader blah = new InputStreamReader(ins);
            inStream = new BufferedReader(blah);
        }catch(IOException aE){
            System.out.println("Error: " + aE );
                msg = inStream.readLine();
                if(msg != ""){
                    msg = "";
                ins = clientsocket.getInputStream();
                System.out.println("e" + msg);
            }catch(IOException aE){
                System.out.println("Error: " + aE);

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.