can any one please tell how to access a dll file from one platform and run it over another platform without using dllimport facility in .Net
socket communication
Collapse
X
-
Well you could use a WebService that exposes the DLL on the one platform so that all platforms and languages can use it.Originally posted by raghubrcan any one please tell how to access a dll file from one platform and run it over another platform without using dllimport facility in .Net
-FrinnyComment
-
Originally posted by PlaterIs that even feasable?
Seems sort of absurd
Hi,
I have accomplished the task of connecting N-number of clients to a server and exchange messages in-between them, but i need to transfer file instead of the messages in an Asynchronous mode..
here is the code i am trying to implement. this code snippet is for message transfer only for a server listening for multiple clients and exchanging messages in between them.
/////////////////////////////file receive method when sent from client/////////////
public void OnReceive(IAsyn cResult ar)
{
String content = String.Empty;
// Retrieve the state object and the handler socket
// from the asynchronous state object.
StateObject state = (StateObject)ar .AsyncState;
Socket handler = state.workSocke t;
int bytesRead;
if (handler.Connec ted)
{
// Read data from the client socket.
try
{
bytesRead = handler.EndRece ive(ar);
if (bytesRead > 0)
{
state.fst.Write (state.buffer, 0, bytesRead);
state.fst.Flush ();
//There might be more data, so store the data received so far.
// state.sb.Remove (0, state.sb.Length );
// state.sb.Append (Encoding.ASCII .GetString(
// state.buffer, 0, bytesRead));
//// Display Text in Rich Text Box
// content = state.sb.ToStri ng();
//SetText(content );
handler.BeginRe ceive(state.buf fer, 0, StateObject.BUF FER_SIZE, 0,
new AsyncCallback(O nReceive), state);
}
}
catch (SocketExceptio n socketException )
{
//the other side closed impolitely
if (socketExceptio n.ErrorCode == 10054 || ((socketExcepti on.ErrorCode != 10004) && (socketExceptio n.ErrorCode != 10053)))
{
// Complete the disconnect request.
String remoteIP = ((IPEndPoint)ha ndler.RemoteEnd Point).Address. ToStr ing();
String remotePort = ((IPEndPoint)ha ndler.RemoteEnd Point).Port.ToS tring ();
// this.owner.Disc onnectClient(re moteIP, remotePort);
handler.Close() ;
handler = null;
}
}
catch (Exception exception)
{
MessageBox.Show (exception.Mess age + "\n" + exception.Stack Trace);
}
}
}
}
//////////class which handles connected clients on server side for file transfer for sending and receiving//////////////////////////////////
public class StateObject
{
// Client socket.
public Socket workSocket = null;
// Size of receive buffer.
public const int BUFFER_SIZE = 1024;
// Receive buffer.
public byte[] buffer = new byte[BUFFER_SIZE];
// Received file stored in static/fixed location.
public FileStream fst=new FileStream(@"c: \\sample1.txt", FileMode.Create ,FileAccess.Wri te);
//public StringBuilder sb = new StringBuilder() ;
}Comment
Comment