eEniquEe Posted November 10, 2010 Share Posted November 10, 2010 Hi, I wonder how could you guys create a server so that another programme in your PC can connect to. The programme I mean is Maxima. Roughly speaking, it's a computer algebra system written in lisp with an emphasis on symbolic computation. Because I'm working on a project, which requires computing a lot of derivatives, and stuff.. So my goal is to use Maxima in the background, and then tell Maxima to connect to my server, and whenever I need to do some differentiation, or something along the line, I'll send the command to Maxima, and Maxima will return the desired result for me. I've also asked on the Maxima forums how to tell it to connect to my programme. And here's a man, who told me that: You open a socket server which listens on port x. Then start maxima with maxima.bat -s x. You can view the full discussion here. What I understand is that, I need to create a server on some port, then open Maxima with maxima.bat -s that port. And everything is done. So, here's my work. I'm just testing if my idea is correct or not. So the code's fairly simple: TCPStartup() $Add = @IPAddress1 $Connection = TCPListen($Add, 64000) If $Connection = -1 Then Exit Run(@WorkingDir & "\bin\maxima.bat -s 64000", "") $k = 0 While 1 $Socket = TCPAccept($Connection) If $Socket <> -1 Then MsgBox(64, "Success", "Success!!!! " & $Socket) ExitLoop Else $k += 1 If $k > 20 Then ExitLoop EndIf WEnd TCPShutdown() Then I put my .exe file inside Maxima main folder. The main purpose of this piece of code is to check whether Maxima connect to my programme (on port 64000). If it does, then a message box will appear, or otherwise, then programme will terminate itself after 20 loops. But Maxima just show up for like 0.5 second, and then disappear, and there's no message box appear. Which, in turns, means that I've done something wrong. If I change the line: Run(@WorkingDir & "\bin\maxima.bat -s 64000", "") to: Run(@WorkingDir & "\bin\maxima.bat", "") Then Maxima shows up (and doesn't disappear), but of course it does not connect to my programme, either. Can I use TCP for a server in this case? I believe using TCP is the wrong choice. So, what can I use instead? Should I use UDP? Can you guys help me please? I'm just so new to this server and client thingy... >.< Thanks everyone in advance, And have a good day, Link to comment Share on other sites More sharing options...
eEniquEe Posted November 10, 2010 Author Share Posted November 10, 2010 Can anyone help me please... Link to comment Share on other sites More sharing options...
ShawnJ007 Posted November 12, 2010 Share Posted November 12, 2010 Try adding in a sleep(500) or sleep(1000) before WEND. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now