mxj tcpClient - Freezing host, Buffer too small?

dfwaudio's icon

Hello everybody.
I have an Issue with Arvids 'mxj tcpClient' java object. Maybe sombody can help, please.
>Max8/Win7 64bit<
I'm using the tcpClient to send telnet commands over :localhost (127.0.0.1) to a lighting software. It seemed to work very well. All commands are transmitted, Latancy is near zero.
But after sending about 330 lines of commands in one connected session, the lighting software freezes 'till i close the connection. If i connect again it works again for 330 lines... then: freezing the host once more.
It depends on the max patch, for shure, because with windows command line there are no problems. I can send more than 5000 lines without any freezing.
I think there is any problem with something like a buffer size. So i spent a day to look into the java files. But since i'm no code line programmer at all, it's really hard. My last attempt was to look into ...Cycling '74\Max 8\resources\packages\max-mxj\java-classes\classes\buf... I can't get any clear information for myself.
Arvid also added an edited 'buf' folder. Sadly it's also a mystery for me.
So, i know this question is very specific, but eventually here are some java pros who can help.

Thanks in advance for any tips & tricks

Matthias

Source Audio's icon

Is UDP not an option ?
There is also shell object for windows, one can send
most commands with it, avoiding java alltogether.
And Sadam tcp Client...
http://www.sadam.hu/download/sadamlib.zip

dfwaudio's icon

Thanks for your fast reply. Unfortunatly the lighting software doesn't receive telnet by udp, only tcp.
I tried shell object, but sadly it doesn't support any telnet commands.... i think.
I tried also Sadam tcp client, but it seems to be all 32bit? Maybe i'll try 32bit Max with Sadam tcp client.

Again, thanks for your fast reply >less than 2 hours< this forum and their users are so magnificient.

Source Audio's icon

last Sadam lib is 32 / 64
check the x64 folder inside of mxe 6 folder

dfwaudio's icon

Yeah... got it. Have to read a little more about telnet then i will post my solution. It's a little weird at the moment. Thanks at all.

dfwaudio's icon

Ok. I don't understand why it works. But it works. Can't find any explaination about this telnet issue.
1. Arvids [mxj tcpClient] is working instantly. You can send telnet messages without any manipulation of the message. Set the right IP and Port. Call message "connect". Here we go. BUT it seems there is a little problem with something like buffersize. After between 300 and 600 sent messages it doesn't work anymore till you disconnect and connect again. So if you want to send only a few messages it's ok but if you want to use a durable and stable connection it's not the right way.
2. [sadam tcpClient] I use this object. For sending messages you have to convert the message from ascii to integers by [atoi] object. Then prepend and append "13" to the message. Now messages are sent to telnet in the right format.
3. [jit.tcpsend] this object is also able to send telnet messages if you send them to the 2nd inlet. It takes normal ascii values but then the software i want to control doesn't get the right message. But if you convert from ascii to integers with [atoi] object, then prepend and append "13" and then convert it back to UTF-8 with [itoa] object the message is sent in the right way. But there are appended some characters which are sent as 2nd message i think "PNNYS" or something. I don't understand why this happen. That's why i don't use this object. Otherwise it would be the best solution for communicating by tcp because you don't need any external.

4. Another option sending telnet messages would be by [shell] object. According to a topic here in the forum it should also work. But i didn't get it to. Normally in cmd shell the command is this:
telnet > open 127.0.0.1 28281 (open (IP) (port))
now you can send telnet commands. It seemed that [shell] object understand the "telnet" command but not the "open" command to connect to right ip and port.

If anyone knows more about telnet, jit.tcpsend or shell: please tell me. I'm very interested.