analize this...
import java.io.IOException;
import java.net.Socket;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.io.DataOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.SocketException;
public class TCPLobbyConnection {
private Socket socket;
private InetAddress IPAddress;
private String result ;
public TCPLobbyConnection(String message) {
try {
byte[] sendData = new byte[1024];
byte[] receiveData = new byte[1024];
socket = new Socket("rr.soldat.pl", 13073);
sendData = message.getBytes();
// output/input implementation
DataOutputStream outToServer =
new DataOutputStream(socket.getOutputStream());
BufferedReader inFromServer =
new BufferedReader(new InputStreamReader(
socket.getInputStream()));
// send the data
outToServer.writeBytes(message);
String result = inFromServer.readLine() ;
System.out.println(result) ;
// STREAMS READY
} catch (UnknownHostException uhe) {
uhe.printStackTrace();
} catch (SocketException se) {
se.printStackTrace() ;
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
Please if someone could help me on this....
at the end of this code the variable String "result" should contains data gathered from lobby connection...
this same code gathers other types of data in other protocols....
to test it just replace de url (rr.soldat.pl) and the port....
in the constructor the parameter String sent to it actually is the request string
in ex: e©42©0©0©0©0©0©0©0©0©0©0©-1©0
something like this....
Date Posted: August 26, 2008, 11:41:24 am
maybe not working if implemented a buffered input???
just don´t know how to communicate with lobby
another question... if someone have gathered the information from lobby
how is the reply lenght? number of chars and number of bytes....
Date Posted: August 26, 2008, 11:46:34 am
still looking for help