Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
[ FlexSim 21.2.4 ]
Can i get the remote client ip and port which connect to server socket in flexsim
Solved! Go to Solution.
[ FlexSim 21.2.4 ]
Can i get the remote client ip and port which connect to server socket in flexsim
Solved! Go to Solution.
You create a server socket that listens for connections to a specified port using servercreatemain(). So, you choose the port number. Your client needs to know the IP address of your server, but I'm not sure if you can access your client's IP address.
Does this help, or were you trying to ask about something else? Would an example of using a socket be useful?
If you're able to attach your model, that would be helpful.
You can try something similar to the solution from your previous question, found here. After the runprogram() command, you would need to read the text file and send the local computer's IP over the socket.
It seems like that you have not understand my question, i can't control the message content that client send, i can only use a server socket building in flexsim to wait client connections and accept meaasge. In this background, i want to know the client ip and port which connect to the server socket in flexsim.
The FlexScript socket commands do not give you access to the connecting client's ip address. The serveraccept() function returns an index for the client connection that is subsequently used to receive messages from that client using serverreceive().
If you want more control over the communication than you get with the FlexScript commands, use external code, such as Python or C++. See Connecting to External Code.
See also accept function (C++) or socket.accept (Python).

Hi @yexioamu, was one of Natalie White's or Phil BoBo's answers helpful? If so, please click the "Accept" button at the bottom of the one that best answers your question. Or if you still have questions, add a comment and we'll continue the conversation.
If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.