question

Catarina avatar image
0 Likes"
Catarina asked Catarina edited

Socket communication Flexsim (Windows) and Linux c++ script

I've been trying to establish a socket communication between Flexsim and a Linux c++ script, but i had no sucess. Someone can help me. I put here the photos of each code i'm using.

FlexSim 24.1.0
windowscommunication socketsocketslinux
· 3
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

Jordan Johnson avatar image
1 Like"
Jordan Johnson answered Catarina commented

I can't debug your C++ program. But I made this demo that works on a local computer (127.0.0.1).

EchoServerDemo.fsm

echo_server.py

The python script makes a simple socket echo server. If you have python installed, you can run the file from a command prompt like so:

  1. cd path/to/folder
  2. python -m echo_server.py

If you run that file, the server just sends and receives in a loop. Once the server is running, you can run the model and see that the model is sending and receiving via the socket. For me, this all worked fine, so I don't think it's an issue with FlexSim's socket code.

It looks like you're trying to connect to a different computer. Sometimes firewalls or other network issues can prevent sockets.

Note: I tested this with Python 3.11.


echoserverdemo.fsm (27.0 KiB)
echo-server.py (669 B)
· 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.