ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
|||
|
|||
clientcreate() returns 0
hey there,
i wrote this piece of code in the OnRunStart trigger. i wanted to initiate a socket communication with a server written in C# Code:
int socknum = clientcreate(); string host = "127.0.0.1"; int sockport = 13000; clientconnect(socknum, host, sockport); clientsend(socknum,"this is flexsim"); I'm using FlexSimn 7.0.6. Thanks for helping! |
#2
|
||||
|
||||
Hello Simon,
I have not any experience in socket communication, I was just looking for threads: Perhaps flexsim still expects the communication from a c++ node rather than a flexscript node mentioned in Nico's thread. Jörg |
#3
|
|||
|
|||
socketinit(); is the solution
finally found the solution. socketinit() has to be called first - some background processes are initalized there. now it works fine!
Code:
socketinit(); int socknum = clientcreate(); string host = "127.0.0.1"; int sockport = 13000; clientconnect(socknum, host, sockport); clientsend(socknum,"this is flexsim"); Last edited by Simon Moosbrugger; 03-17-2014 at 04:48 AM. |
The Following 5 Users Say Thank You to Simon Moosbrugger For This Useful Post: | ||
Tom David (03-19-2014) |