EhsanCompanY
Lurker
Hi, I'm new to android
I'm trying to use UDP to send and receive my data
This code I used is for sending data, but I can't receive data on UDP
can any one give me a hint how to receive as easy as sending UDP?
I'm trying to use UDP to send and receive my data
Java:
public class sMessage implements Runnable {
@Override
public void run() {
try {
DatagramSocket s = new DatagramSocket();
InetAddress local = InetAddress.getByName("192.168.16.254");
int msg_length=messageStr.length();
byte[] message = messageStr.getBytes();
DatagramPacket p = new DatagramPacket(message, msg_length,local,server_port);
s.send(p);
} catch (IOException e) {
Log.e(TAG, "ERROR");
}
}
}
can any one give me a hint how to receive as easy as sending UDP?