question

Meng,Li avatar image
0 Likes"
Meng,Li asked Meng,Li commented

How to send TCP data packet through socket from Flexsim to external application?

Hi!@Ben Wilson @steven.hamoen , Is there a way to send TCP data packet from Flexsim to external application such as WCS/WMS through socket? I see the command clientsend() can only send data in string type.I have learn the socket example by @Logan Gold,and also the question : What would be the best way to communicate between Flexsim and other processes, e.g. a WMS system?, but still can not get a clue.

Could anyone give some suggestions?

FlexSim 19.2.4
flexsim 19.2.4socket
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Steven Hamoen avatar image
0 Likes"
Steven Hamoen answered Meng,Li commented

@meng L Yes ofcourse you can send data packets from FlexSim to an external application. That is where the socket are created for. The sockets sends array of characters. So if you need to send numbers you have to convert them. What often happens is that they are used to send telegrams with a fixed format. So the first 10 characters determine a command, the next 5 characters the value belonging to that command etc.

If you already have the socket example and it is working why are you still not having a clue? What is it exactly that you don't understand?

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Meng,Li avatar image Meng,Li commented ·

Thanks for your reply ,hamoen. Execuse for my late response.

Here attached two models sockets_client.fsmsockets_server.fsm,in which i tried to figure out how to implement basic interaction( Three-way Handshaking ) between server and client.

As a client , i send a task message, like "FEFEFEFE,taskNum:1001,FEFEFEFE",to the server. Then i check whether a Ack message is sent back to me from the server every 0.1 second, and i will resend the task message if i have checked ten times without any response.

Something wrong with reading message happens in my model. and i don't know what is the right way to send and read message as transmission process implemented in byte stream mode.

0 Likes 0 ·
sockets-client.fsm (24.8 KiB)
sockets-server.fsm (18.7 KiB)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.