newbie here. I successfully created a chat server using c# (server partial code below, got it somewhere though. rights goes to the owner) and clients able to connect and it is working as expected. now my question is can I make a client application that will connect from android?
private void loadchatserver()
{
try
{
// Initialise the ArrayList of connected clients
this.clientList = new ArrayList();
// Initialise the delegate which updates the status
this.updateStatusDelegate = new UpdateStatusDelegate(this.UpdateStatus);
// Initialise the socket
serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
// Initialise the IPEndPoint for the server and listen on port 30000
IPEndPoint server = new IPEndPoint(IPAddress.Any, pubcommandport);
// Associate the socket with this IP address and port
serverSocket.Bind(server);
// Initialise the IPEndPoint for the clients
IPEndPoint clients = new IPEndPoint(IPAddress.Any, 0);
// Initialise the EndPoint for the clients
EndPoint epSender = (EndPoint)clients;
// Start listening for incoming data
serverSocket.BeginReceiveFrom(this.serverdataStream, 0, this.serverdataStream.Length, SocketFlags.None, ref epSender, new AsyncCallback(ReceiveServerData), epSender);
}
catch (Exception ex)
{
MessageBox.Show("Loadchatserver: " + ex.Message);
}
}
Sure you can.
Sockets are a global protocol that any major programming language supports.
Here’s a nice tutorial for Sockets in Java (should work the same way with Dalvik – the Android implementation of Java):
http://docs.oracle.com/javase/tutorial/networking/sockets/