TCP/IP Connection failed

Six Stars

TCP/IP Connection failed

Hello everybody, iam a beginner in Talend ESB.

 

I want to establish a TCP/IP connection to a Server. It's an RFID reader.

I have to send the reader an XML message via TCP / IP to a Host: "141.79.224.86" and a Port: 10001.

The XML message is called HostGreetings.

(<frame><cmd><id>1</id><hostGreetings><readerType>SIMATIC_RF680R</readerType><supportedVersions><version>V2.0</version><version>V2.1</version><version>V2.2</version></supportedVersions></hostGreetings></cmd></frame>)

After sending I have to get an answer. But that doesnt work.

 

My process is as follows:

 

Unbenannt.png

In the first step i send the whole code via tFileDelimited to the tSocketOutput (Client). This is working.

Unbenannt2.png

The answer i can see only about wireshark i get one. But in Talend it does not show me.

Unbenannt3.png

Thats the mistake i get.

 

Does anybody know what i'm doing wrong?

 

Thanks in advance!!!!

 

Kind regards

Ao

Sixteen Stars

Re: TCP/IP Connection failed

Try this.

 

Have two separate jobs. One for sending the message and one for receiving the message. Start the job that is sending the message first. Then start the job which is receiving the message while the first job is still running. You should then see it working. The problem with doing this in one job is that the components need to be sending and receiving at the same time. You can do this quite easily with the tParallelize component in the Enterprise Edition.

Employee

Re: TCP/IP Connection failed

your job design is wrong... 

 

1) 1st job: Open the port by using tsocketInput component and make sure timeout is bit high and give you enough time to execute second job

2)  2nd Job: Send your file to tsocketOutput in this job.

 

 

socket_testing.JPG

Sixteen Stars

Re: TCP/IP Connection failed

To be honest, the order of the jobs is not terribly important so long as you ensure that there is a crossover where they are both sending and trying to receive at the same time. To do this there are a few methods you can use. But it makes sense to look at the tSocketOutput's timeout and retry times AND the tSocketInput's timeout. Whichever you have more control over should have its timeout lengthened (and assigned more "trys" in the tSocketOutput's case).

Six Stars

Re: TCP/IP Connection failed

Many thanks for the answer.

 

I have tried this several times before. But without success.

 

SocketServer (first job that is running):

1.png

 

SocketClient (Secound Job):

2.png

With two separate jobs, it works only via localhost!

 

SocketServer: (Starting)

SocketClient: runs

 

after the timeout comes an error message.

 

Starte Job SocketServer am 10:58 21/02/2018.
[statistics] connecting to socket on port 3846
[statistics] connected
Exception in component tSocketInput_1 (SocketServer)
java.net.SocketTimeoutException: Accept timed out
    at java.net.DualStackPlainSocketImpl.waitForNewConnection(Native Method)
    at java.net.DualStackPlainSocketImpl.socketAccept(Unknown Source)
    at java.net.AbstractPlainSocketImpl.accept(Unknown Source)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at rfidtosap.socketserver_0_1.SocketServer.tSocketInput_1Process(SocketServer.java:514)

 

When i mark at tSocketInput (bind host name), an error message comes immediatly.

 

Starte Job SocketServer am 11:01 21/02/2018.
[statistics] connecting to socket on port 4063
[statistics] connected
Exception in component tSocketInput_1 (SocketServer)
java.net.BindException: Cannot assign requested address: JVM_Bind
    at java.net.DualStackPlainSocketImpl.bind0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketBind(Unknown Source)
    at java.net.AbstractPlainSocketImpl.bind(Unknown Source)
    at java.net.PlainSocketImpl.bind(Unknown Source)
    at java.net.ServerSocket.bind(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at rfidtosap.socketserver_0_1.SocketServer.tSocketInput_1Process(SocketServer.java:507)
    at rfidtosap.socketserver_0_1.SocketServer.runJobInTOS(SocketServer.java:938)
    at rfidtosap.socketserver_0_1.SocketServer.main(SocketServer.java:787)
[statistics] disconnected
Job SocketServer endet am 11:01 21/02/2018. [exit code=1]

 

I dont know what else to do! Smiley Sad

Sixteen Stars

Re: TCP/IP Connection failed

Have you tried the "Bind host name" option in the tSocketInput component?

Six Stars

Re: TCP/IP Connection failed

When i mark at tSocketInput (bind host name), an error message comes immediatly.

 

Starte Job SocketServer am 11:01 21/02/2018.
[statistics] connecting to socket on port 4063
[statistics] connected
Exception in component tSocketInput_1 (SocketServer)
java.net.BindException: Cannot assign requested address: JVM_Bind
    at java.net.DualStackPlainSocketImpl.bind0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketBind(Unknown Source)
    at java.net.AbstractPlainSocketImpl.bind(Unknown Source)
    at java.net.PlainSocketImpl.bind(Unknown Source)
    at java.net.ServerSocket.bind(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at rfidtosap.socketserver_0_1.SocketServer.tSocketInput_1Process(SocketServer.java:507)
    at rfidtosap.socketserver_0_1.SocketServer.runJobInTOS(SocketServer.java:938)
    at rfidtosap.socketserver_0_1.SocketServer.main(SocketServer.java:787)
[statistics] disconnected
Job SocketServer endet am 11:01 21/02/2018. [exit code=1]

Sixteen Stars

Re: TCP/IP Connection failed

You have to bind it to an IP address that belongs to the machine you are running the code on. This says to me that the IP address you have bound it to does not belong to the machine you are running it on.

Six Stars

Re: TCP/IP Connection failed

Sorry i didnt quite understand that. Iam connected to the RFID reader via VPN. The reader is somewhere at the college. I can ping the reader via the host address: "141.79.224.86". So what does that mean exactly?

Six Stars

Re: TCP/IP Connection failed

How can i bind it? Smiley Frustrated

Sixteen Stars

Re: TCP/IP Connection failed

If you are on a VPN, your machine will have an IP address assigned by the VPN. But only if your machine is creating your VPN connection. If you are sharing a VPN connection across your network (maybe if your router is creating the VPN connection) you may be sharing the VPN connection's IP address. In which case you might have to go down the route of port forwarding on your router. This sounds like a networking problem, which isn't really a Talend problem.

Six Stars

Re: TCP/IP Connection failed

I reach hin and he answers me. Here is whats going on in Wireshark when i play the scenario from above.

Unbenannt.png

I dont think that is a network problem otherwise i would not reach it right? Smiley Frustrated

Sixteen Stars

Re: TCP/IP Connection failed

It looks like your tSocketInput should be bound to 141.79.36.115. If it cannot bind to that IP then you will need to investigate why Talend does not think your machine owns that IP. Try an ipconfig (or ifconfig on linux/Mac) call to see which IP addresses your machine owns.

Six Stars

Re: TCP/IP Connection failed

Unbenannt.png

 

Since iam connected via VPN this is my new IP Adresse. I have now entered this address at tSocketInput.

It does not come immediately an error message as at 141.79.224.86.

 

Now comes:

 

[statistics] connecting to socket on port 3632
[statistics] connected
Exception in component tSocketInput_1 (SocketServer)
java.net.SocketTimeoutException: Accept timed out
    at java.net.DualStackPlainSocketImpl.waitForNewConnection(Native Method)
    at java.net.DualStackPlainSocketImpl.socketAccept(Unknown Source)
    at java.net.AbstractPlainSocketImpl.accept(Unknown Source)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at rfidtosap.socketserver_0_1.SocketServer.tSocketInput_1Process(SocketServer.java:470)
    at rfidtosap.socketserver_0_1.SocketServer.runJobInTOS(SocketServer.java:880)
    at rfidtosap.socketserver_0_1.SocketServer.main(SocketServer.java:729)
[statistics] disconnected
Job SocketServer endet am 12:27 21/02/2018. [exit code=1]

 

 

 

Sixteen Stars

Re: TCP/IP Connection failed

This is because it is not receiving a message before its timeout period ends.....but the address is being bound.

 

You haven't answered my question about your VPN. Can your RFID server see your machine directly? If your RFID server were to ping your IP address, would it work? This is important. This is clearly a networking issue.

Six Stars

Re: TCP/IP Connection failed

When i connect via VPN, iam in the same network as the RFID server. I can ping him and i get a response.

I didnt unterstand what you mean by that. The RFID-Reader cant ping me? I just get a response when i ping him.

 Unbenannt.png

Six Stars

Re: TCP/IP Connection failed

What is the green marked? This is what i see...

 

Unbenannt.png

Sixteen Stars

Re: TCP/IP Connection failed

OK, I am getting confused here. Can you answer some questions?

1) Have you got a simple solution working with two jobs just posting from one job to the other (using localhost)?

2) Have you been trying this with your VPN connected?

3) Have you ensured that the port you are using is free?

4) Do you know the that RFID is receiving the message?

5) Is the RFID responding on the same port?

6) Can you try this on your local network without the VPN?

 

It looks like this is a network error. If you have tested the use of the tSocketInput/Output using localhost and it worked, then this question has been resolved in relation to Talend. We are now trying to debug your networking. Networking is notoriously complicated and trying to debug a job like this without trying it on the simplest network first is a bad idea. You need to try this on a local network.

Six Stars

Re: TCP/IP Connection failed

Sorry for confusing...

 

to 1) Yes, i did that. This works with Localhost. But not with my IP-Addresses (RFID)

to 2) Yes, unfortunately, in vain

to 3) Yes, i did

to 4) Yes, otherwise i would not receive any feedback from the reader (Wireshark)

to 5) Yes

to 6) No, that doesnt work (tSocketOutput would not send)

Six Stars

Re: TCP/IP Connection failed

The problem is that i want to send data via TCP.

(My IP: 141.79.36.115 / Port:53523 (variable) )

The RFID System wants to send me to the same IP address and the same port data. But via tSocketInput i define a different port.

Is there a solution for this?

Sixteen Stars

Re: TCP/IP Connection failed

With question 6 I meant have you tried moving the RFID device to your local network? You really need to do that or work on the local network that this device is on. The reason for this is that the VPN configuration is likely a cause, but we cannot confirm that unless you can prove it works without the VPN.

 

Another couple of things to think about since this only seems to receive messages back when you are running within your computer, do you have a firewall running on your machine? This could be blocking the returning messages.

Sixteen Stars

Re: TCP/IP Connection failed

Why are you defining a different port? Are you saying the RFID randomly picks a different port to send back to?

Six Stars

Re: TCP/IP Connection failed

I tried it locally. This is the same as when i work over VPN. VPN is not the cause.

 

I deactivited all firewalls too. Unfortunately no success.

Six Stars

Re: TCP/IP Connection failed

I have an IP Address with a random port. I cant pin it down.

The RFID System receives the massage, he wants to send me the answer on the port where he got the message.

You can see that in Wireshark.

But i want that he doesnt answer me on tSocketOutput but on tSocketInput with a defined IP address and a defined port.

Sixteen Stars

Re: TCP/IP Connection failed

You need to understand how your RFID device is working. It won't be a completely random port, there will be some logic to it. That logic needs to be understood before you get this to work.

 

This Talend question is solved though. You can now get a message out and a response back. The problem you have now is with your RFID device and understanding how it works. When you have the precise way in which that is expected to work, come back and post a question about that. 

Six Stars

Re: TCP/IP Connection failed

Iam sorry I didnt explain it well enough. Again...

 

I send a message to the RFID System (tSocketOutput) IP:141.79.224.86 / Port:10001

 

Unbenannt.png

 

The RFID System wants to answer me. But never reach me!!!!!

 

Sixteen Stars

Re: TCP/IP Connection failed

I understand that. But you said "I have an IP Address with a random port. I cant pin it down". You keep introducing more variables. If you send from IP 10.1.1.2 to IP 20.2.2.1 on port 1010, what port will IP 20.2.2.1 send the response message on? Port 1010?

If the above is the case, then you need to know if your VPN is preventing your RFID device from sending the message back to you. I am afraid I cannot do this for you. I can help you with Talend stuff, but you have SO many variables and are assuming that Talend is the cause. You need to eliminate all other potential variables and try to get it to work with Talend (as mentioned earlier, try with the RFID device on the same local area network as your machine and with a single IP address assigned to your machine), then move on to a more complex environment once that is shown to work. 
 

Eight Stars

Re: TCP/IP Connection failed

Hi,

 

maybe I am wrong. Maybe I overlooked something, but have you tried to specify the bind address for tSocketInput? I see you have several IP addresses so it would be nice to define where to open the port...

Capture.JPG

 

 

 

 

 

 

 

 

 

 

If you already discussed this option just skip my post.

 

Regards

Lojdr

Six Stars

Re: TCP/IP Connection failed

Ok an Other question maybe solves the problem..

Is it possible to bind the Port from which i am sending the request via tsocketoutput in the properties i could just set the port i am sending to but i want to set the Port i am sending from
Sixteen Stars

Re: TCP/IP Connection failed

The tSocketOutput's port is the RFID's listening port. The tSocketImport's port is the machine's port that it needs to listen on. You need to know which port the RFID is listening on and which port it will send back to. This should either be documented by the RFID device's manufacturer or should be discoverable.

As I have said before, you need to simplify this first. You need to work with the RFID device on the same local area network as your machine. You need to remove any firewalls. You need to ensure that your machine only has one IP address and you need to make sure your port is free. Once that basic environment is set, then you can work on the Talend job without the possibility of other variables causing an issue. You also need to understand how the RFID device works. Does it receive on one port and respond on another, for example?