i will describe it briefly. i need to create a dll class to establish a socket communication and that dll class i should use it between the client App and the server App. but the main task is not done yet which is how to enforce editing to the display controls in both Apps by the Class functions. that is it. any help will be appreciated.
for example the following is the logic we use for client Connect
//=================
public void ClientConnect(string ServerIP, string Port)
{ try
{ // Create the socket instance
m_clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
// Cet the remote IP address
//IPAddress ip = IPAddress.Parse(ServerIP.ToString());
//int iPortNo = System.Convert.ToInt16(Port);
// Create the end point
IPEndPoint ipEnd = new IPEndPoint(IPAddress.Parse(ServerIP.ToString()), Convert.ToInt16(Port));
// Connect to the remote host
m_clientSocket.Connect(ipEnd);
if (m_clientSocket.Connected)
{
//Wait for data asynchronously
WaitForDataClient();
}
}
catch (SocketException se)
{
string str;
str = "\nConnection failed, is the server running?\n" + se.Message;
//MessageBox.Show(str);
}
}
i put this in a Class so it becomes like this:
ClientServerCom MySocket = new ClientServerCom(); // here is the Class Object Declaration
MySocket.ClientConnect(textBoxIP.Text, textBoxPort.Text); // here is establishing the Connection
now you got the idea, what i missing here is how to enforce any control on the server App to display the received messages once the client thread send it. i know i have to specify by coding a specific function on the server side to override another function in the created socket class and that what i'm trying to do.
please help in this good idea.