Multiple TN3270 Connections out from one program

Topics: Developer Forum, User Forum
Jul 22, 2011 at 5:07 PM

I am just trying to make 4 connections out to 2 different servers. When I make any of the connections without the other ones it works properly. However when I attempt to open more than one at a time the second on wards always fails. I believe this is due to all of the connections trying to go out through port 23. Is there any way to connect TO port 23 FROM a different port? Or am I doing something horribly wrong. 

I am using version 55326 and clyde_coulter's branch as that is the one recommended in the discussions.

Here is the code snippit of the connection.

strABServ and strBCServ are pre-assigned server names as strings.

 

tnCRISAB = new TNEmulator();
tnCRISAB.Config.TermType = "IBM-3278-2-E";
tnCRISAB.Config.FastScreenMode = true;
tnCRISAB.Connect(strABServ, 23, null);
tnCRISBC = new TNEmulator();
tnCRISBC.Config.TermType = "IBM-3278-2-E";
tnCRISBC.Config.FastScreenMode = true;
tnCRISBC.Connect(strBCServ, 23, null);
tnFMSAB = new TNEmulator();
tnFMSAB.Config.TermType = "IBM-3278-2-E";
tnFMSAB.Config.FastScreenMode = true;
tnFMSAB.Connect(strABServ, 23, null);
tnFMSBC = new TNEmulator();
tnFMSBC.Config.TermType = "IBM-3278-2-E";
tnFMSBC.Config.FastScreenMode = true;
tnCRISBC.Connect(strBCServ, 23, null);
  

Jul 23, 2011 at 6:06 PM

Hi Stile1987,

Are you using conection ponts?  I added that ability....

I'm using multiple threads.  Well, actually there are multiple threads because the clients connect to my server via .NET Remoting.  Each conversation gets it's own thread.

Can you assign different ports? (my server contacts the CICS session on the mainframe via VPN, so each connection to the 3270 sessions has a different IP, same port #).

...Clyde

Jul 23, 2011 at 10:52 PM

Hi Clyde,

 

First off, THANK YOU for the working version you had released AND thank you for the response.

 

I actually figured it out about 2 hours after I posted, I just needed to modify your code just a little bit.

 

In telnet.cs I changed the socket bind code to be 

                    bool bcantbindport = false;
                    localIEP.Port +=1000 
                    do
                    {
                        try//try to connect to local socket
                        {
                            mSocketBase.Bind(localIEP); // CFCJR
                            bcantbindport = false;
                        }
                        catch (System.Net.Sockets.SocketException se)
                        {

                            localIEP.Port += 1;
                            bcantbindport = true;

                        }
                    } while (bcantbindport&&localIEP.Port<1500);

now everything is happy :)