Request Response using TCPIP Adapter

Topics: Developer Forum, User Forum
Mar 6, 2007 at 1:48 PM
Hi All,

Thanks for providing this adapter for the community. I've successfully managed to use it for a request scenario, I mean the client application sends message to a TCP IP port on server and from their biztalk picks it up using the adapter and output goes to a file.

But I am not able to use it in a request-response scenario, in fact there is no error on biztalk end, which means that it is processing the request message and putting it to the tcp ip port for client to pick it up, but I get the error while trying to get that message from my client, here is the code which I am using to put and get the message in c#:

try
{
socObj = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
System.Net.IPAddress ipAdd = System.Net.IPAddress.Parse("10.1.107.86");
System.Net.IPEndPoint remoteEP = new System.Net.IPEndPoint(ipAdd, 4765);
socObj.Connect(remoteEP);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

try
{
string szData = @"<ns0:TulipInfo xmlns:ns0=""http://DirectRequestResponse.Tulip""><Color>Color0</Color><Size>Size0</Size><Weight>Weight_0</Weight></ns0:TulipInfo>";

byte[] byData = System.Text.Encoding.ASCII.GetBytes(szData);

socObj.Send(byData);

byte[] RecData = new byte2000;
socObj.ReceiveTimeout = 200000000;
socObj.Receive(RecData);
string Response = System.Text.Encoding.ASCII.GetString(RecData);
MessageBox.Show(Response);
}
catch (SocketException se)
{
MessageBox.Show(se.Message);
}

I get this error on socobj.Receive() step, "An existing connection was forcibly closed by the remote host". Why this is happening, Am I not using the correct code or is there anything wrong with the setting on server?

I'd be really grateful for any help as we need this urgently...

Regards,
Sajid.
Coordinator
Mar 6, 2007 at 10:26 PM
Take a look at the TCPClient test harness which is supplied with the Adapter. Source code is provided
Jul 30, 2007 at 8:44 PM
Hello
My problem is also related with Request-Response scenario using TCP Adapter.
The client connects using a program written in C, The tcp adapter seems to send Reset ACknowledgements which is causing the connection to terminate.
The client is unable to receive any response data from the tcp adapter.
The client has sent a packet sniffer output and the output indicates that there is a Reset acknowledgement being sent.
The strange thing is that a test client written in C# works fine.
Any thoughts.