cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP connection in UDF Timeout

Former Member
0 Kudos

Hi Guys,

Can someone please tell me if there's some way to trace this. I'm doing a TCP/IP connection to an external server from our PI Dev system in a UDF. I've designed this code in an external java tool and everything works fine. I can send the message over the protocol and I get a response back but if I test the UDF in my MM it times out and kicks me off the network. I've asked the firewall guys to have a look but all they they there's no scanning on this rule and nothing's being blocked. I need to find out how come I can't get a connection to this IP and Port. Any idea? Also would I be able to run a tracert command in R/3 itself?

Thanks,

Jan

Edited by: Jan de Lange on Oct 19, 2011 9:54 AM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

If i understood correctly,

In the UDF, when you call the endpoint url, have you tried to use the TRY/CATCH statement to get the error message?

try {
} catch (Exception e) {
}

You can map the Exception variable to a Structure Text field to get the connection error message.

Former Member
0 Kudos

Hi,

I've tested my code in my 3G which gets a connection and send/receive data. However if I deploy it on PI It times out after a while. At s.connect(serverAddress, 30000); it can't get a connection to the host. There's no error message, just times out. I'll see what I can come up with working with the network people. They just HAVE to do a trace on it.

try
        {
            System.out.println("Creating Socket: " + ip + ":" + port);

            //Create Socket Address
            SocketAddress serverAddress = new InetSocketAddress(ip, Integer.parseInt(port));
            s = new Socket();
            //Set Keep Alive Parameter
			s.setKeepAlive(true);
			//Set Read/Write Timout
			s.setSoTimeout(20000);
			//Open Connection with Address + Process Timout
            s.connect(serverAddress, 30000);

            System.out.println("Socket Created: " + s);
    }
        catch(UnknownHostException uhe)
        {
            // Host unreachable
            System.out.println("Unknown Host :" + ip);
			errorTrace+=(";Unknown Host :" + ip);
            s = null;
        }

Former Member
0 Kudos

Try to use also other types of exceptions:

catch (Exception e) // UnknownHostException, SecurityException
       {

       }

Shabarish_Nair
Active Contributor
0 Kudos

try to do the same from your local machine i.e in an independent piece of java code.

in case you still get the timeout, i am assuming that this has to be a network problem. Also make sure there is proper exception handling in the code so that it might prompt with the correct exception.

You might then have to have your network team involved and enable a trace to see what is the issue.

Former Member
0 Kudos

Hi Jan,

Out of interest, just wanted to check why you are trying to connect to an external system via UDF. Can you elaborate your requirement? Dont you have any other options?

Regards

Krish

Former Member
0 Kudos

I need to send a XML document over a TCP/IP stream to the client and they respons with in the same way. Only way I know of doing this is via java module? I've been looking into RFC (Type T) but can't find any examples on sdn.