Hi guys.
I’m the learning stages of DIY networking, and sofar i have succesfully been able to communicate between
different pc’s both over Lan but also over the internet. Even Arduino units, without any major issues.
Android with unity is however another matter… ![]()
I’m using unity Pro, android free, but i got the “Good old sockets” asset to replace the system.net.sockets
and while it works fine in “gamemode” in unity editor, I’m not able to send from any of my android devices.
I’ve setup a receiving server, that reads and displays all udp packets recieved. also testet both lan and www works.
Now doing this with an android build does not work at all.
This is the part I use for the sending of the udp packet, and works for all other devices other than android.
IP + IPport is obviously the public ip and port.
sendData is the actual string/msg im trying to send
void sendUDP(string sendData){
byte[] myData = System.Text.ASCIIEncoding.ASCII.GetBytes (sendData);
IPEndPoint ep = new IPEndPoint (IPAddress.Parse (IP), IPport);
Socket myClient = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
myClient.SendTo(myData, ep);
myClient.Close();
}
I’m not getting any errors, freezes, or indication of any kind that there is a problem, on the device.
However the message is never recieved, now considering it works from all sorts of other things like
different computers, avr microprocessors, it’s very odd that i cant send from the android device.
The device is connected to the web via WIFI, so it should be able to “just broadcast” .
Any suggestions ?