Android .NET Sockets .dll problem
There is a tablet type here in Serbia called Tesla Tablets.
My application uses .NET sockets to make a connection between that tablet and a windows machine. The error i get when i start the application on android is:
Unable to find user32.dll Unable to find Kernel32.dll
Which confuses me totally since its running on android.
Is there a way to build thse dll-s into my build?
Answer by Statement · Nov 03, 2015 at 02:11 PM
user32.dll and Kernel32.dll are native Windows Operating system dynamic link libraries.
No, you can't use those.
I am a bit unsure what the situation is here; But if you added Windows .NET assemblies into your project, remove them from your Assets folders. Mono should have platform independent System.Net.Sockets namespace and you shouldn't have to reference platform specific libraries. You should be able to access System.Net.Sockets without referencing additional libraries.
To me it sounds like you're using Assemblies that depend on Windows. Did you drag some .NET assemblies into your project?
Thats what confuses me, and no i didnt. The thing is that the app is working fine on other devices.
So you have no references to .NET assemblies (other than the assemblies Unity ships with $$anonymous$$ono?)
What types and methods are you using?
i just noticed that that error is fired on every device in the ADB of android studio :(, however other devices work. I do reference the .NET and the socets for example udpClient.BeginReciving(). thats where it fails.
Just trying to get on the same page of ter$$anonymous$$ology, are you using $$anonymous$$onos Sockets or .NET/$$anonymous$$icrosofts Sockets? You can't expect .NET framework libraries to work, but you should be able to use $$anonymous$$ono framework libraries. Unity should already reference $$anonymous$$ono libraries behind the scenes.
Answer by UnityCX · Nov 03, 2015 at 06:27 PM
Here is the code:
this method is called on Start() method
void StartGameClient()
{
Debug.LogError ("Strting to listen");
remote_end = new IPEndPoint(IPAddress.Any, startup_port);
udp_client = new UdpClient(remote_end);
udp_client.EnableBroadcast = true;
udp_client.BeginReceive(new AsyncCallback(ServerLookup),null);
}
//this method is called every 0.5 seconds.
void StartBroadcast()
{
udp_client = new UdpClient();
string BroadcastAdress = NetworkHelper.GetIpAdressForBroadcast();
remote_end = new IPEndPoint (IPAddress.Parse(BroadcastAdress), startup_port);
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
s.SendTo(DataToSend, remote_end);
}