Cannot receive data sent across socket connection by .NET app

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a .NET app that connects to a third-party server on a socket and sends
data. This works with a test server on the local network, but does not work
across the frame connection to the third-party server. They see a connection,
but never see any data coming across.
This works with Win32 app using winsock.
However, if I use [DllImport] and call a Win32 dll that uses Winsock from my
..NET app, it does not work.
Is there some setting in .NET framework security or my code that I am missing?
Any ideas?

Thanks
 
Here's the code from the client side. The server is a third party app and it
sees a connection, but never sees any data coming through. From a pure Win32
app, the third party app is able to see the data. I have tested this locally
using a test server and the data goes through fine.
----------------
IPAddress ipAddress = IPAddress.Parse(host);
IPEndPoint ipe = new IPEndPoint(ipAddress,port);
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
socket.Connect(ipe);
String msgtxt = "Hello";
byte[] msg = Encoding.ASCII.GetBytes(msgtxt);
int bytesSent = 0;
bytesSent = sk.Send(msg,SocketFlags.DontRoute);
sk.Shutdown(SocketShutdown.Both);
sk.Close();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top