Cancel
Showing results for 
Search instead for 
Did you mean: 

Question about the Socket~

Experimenter
Experimenter

Hello everybody~ 

 

I'm making an interface by using SOCKET to transfer the data between the Java program and Plant Simulation.

Currently, I am using a simple example to do the experiment on a same computer. Plant Simulation as a client.

  1. The first problem is that when Plant Simulation send the message to Java. After I run the 'SendMessages' method, Java can not receive the message immediately. However, if I open the SOCKET and click the 'OK' button, the message can be received at that time. So I add some codes to execute this 'OPEN & OK' operation. So now Java can receive the message from Plant Simulation. But I wonder to know the reason why I need to open the SOCKET and click the OK button?1.png
  2. The second problem is that the message can be sent to the Java program from Plant Simulation as I mentioned. However, Plant Simulation is not able to receive the message from Java program. The figure shows the settings.2.png

Can you please let me know whether I'm using correct method or any changes I want to make it run?

 

Thank you very much. 

3 REPLIES

Re: Question about the Socket~

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello LinGui,

after you have sent a message the operating system decides when the message is sent over the network.

Basically it waits until the send buffer is full or there is no more data coming within a time limit.

You can use the method 'setSendBufferSize' to define the size of the send buffer.

 

To receive data without having a connection to a server socket you need a socket which has the 'Server Socket' checked.

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Question about the Socket~

Experimenter
Experimenter

Thank you, Ralf !

Re: Question about the Socket~

Solution Partner Creator Solution Partner Creator
Solution Partner Creator
Hello Ralf,

I have a question:- there will be only one client socket in plant sim to both receive (Via callback method) and send message to Java server. Is my understanding right?

Can you ellaborate- To receive data without having a connection to a server socket you need a socket which has the 'Server Socket' checked.

Do we need one more socket which is marked as server socket to send data to Java?

Regards,
Kavitha