Forums > MaxMSP

raw chars over tcp

May 8, 2007 | 3:11 pm

Hi,

I need to send raw char data over tcp to a server. seems like [mxj tcp.net.send] does the job but not quite.

In the example below, I pack my lists with itoa and the list (255 255 …) gets sent over fine (the server spits out series of 0xFF, as expected) but the list of (0 0 …) not. What am I missing? I’m on windows xp and I know that some externs are not available to me (ascii, aka.datagram). I looked quickly into implementing a tcp client with lua (via jit.gl.lua) but I can’t get luasocket working with jit.gl.lua (perhaps I should ask the jit.lua quesiton on the jitter forum…)

Anyways, thanks for any pointers.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 67 131 133 9109513 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
#P message 75 151 293 9109513 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255;
#P newex 137 230 51 9109513 print Oups;
#P newex 67 230 54 9109513 print Yeah!;
#P newex 67 173 40 9109513 itoa;
#P newex 67 208 211 9109513 mxj net.tcp.send @address 127.0.0.1 @port 666;
#P connect 1 0 0 0;
#P connect 0 0 2 0;
#P connect 0 1 3 0;
#P connect 4 0 1 0;
#P connect 5 0 1 0;
#P window clipboard copycount 6;


May 8, 2007 | 5:08 pm

Hi,

it’s probably because ascii character no. 0(null) is typically used
to terminate a string. Maybe you’ll have to modify mxj tcp.net.send –
the source doesen’t seem to be too complicated( you can send
viewsource message to mxj tcp.net.send).

hth,
nesa


May 8, 2007 | 10:22 pm

I have a java class for raw TCP communicaton that I just put on my
website. It *may* help you. It connects to an arbitrary tcp server.

http://www.barrythrew.com/software.html

b

Mike wrote:
> Hi,
>
> I need to send raw char data over tcp to a server. seems like [mxj tcp.net.send] does the job but not quite.
>
> In the example below, I pack my lists with itoa and the list (255 255 …) gets sent over fine (the server spits out series of 0xFF, as expected) but the list of (0 0 …) not. What am I missing? I’m on windows xp and I know that some externs are not available to me (ascii, aka.datagram). I looked quickly into implementing a tcp client with lua (via jit.gl.lua) but I can’t get luasocket working with jit.gl.lua (perhaps I should ask the jit.lua quesiton on the jitter forum…)
>
> Anyways, thanks for any pointers.
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P message 67 131 133 9109513 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
> #P message 75 151 293 9109513 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255;
> #P newex 137 230 51 9109513 print Oups;
> #P newex 67 230 54 9109513 print Yeah!;
> #P newex 67 173 40 9109513 itoa;
> #P newex 67 208 211 9109513 mxj net.tcp.send @address 127.0.0.1 @port 666;
> #P connect 1 0 0 0;
> #P connect 0 0 2 0;
> #P connect 0 1 3 0;
> #P connect 4 0 1 0;
> #P connect 5 0 1 0;
> #P window clipboard copycount 6;
>
> –
> –
> TBD
>


barry threw
composition : sound : programming
http://www.barrythrew.com
bthrew(at)gmail(dot)com
857-544-3967

And I know not if, save in this, such gift be allowed to man,
That out of three sounds he frame, not a fourth sound, but a star.
-Robert Browning


May 10, 2007 | 6:13 am

Thanks for that but it still does not solve my problem. I need to send a "0" (bit 00000000) to a piece of hardware (well, actually a "driver") and none of the tcp (or udp) objects available in Max (on Windows at least) are capable of doing this. I understand that is treated as ASCII "null" character but I would like to see a tcp extern that does not treat it as such.

any other pointers?

Quote: barry threw wrote on Tue, 08 May 2007 18:22
—————————————————-
> I have a java class for raw TCP communicaton that I just put on my
> website. It *may* help you. It connects to an arbitrary tcp server.
>
> http://www.barrythrew.com/software.html
>
> b
>


May 10, 2007 | 11:16 am

sorry for chiming in late without having read the whole thread:
perhaps what I say is irrelevant:

why can’t you use udpsend with the ‘CNMAT’ flag set (see helpfile)
and concentrate on getting your zero into a char buffer (which I
imagine is fairly trivial in java ?).
I don’t think you need to use an alternative for udpsend, you need
somehting to put your raw char data into a buffer udpsend can
understand, like aka.datagram can do on the mac.

or am I missing something here ?

ciao,

Joost.

On May 10, 2007, at 8:14 , Mike wrote:

>
> Thanks for that but it still does not solve my problem. I need to
> send a "0" (bit 00000000) to a piece of hardware (well, actually a
> "driver") and none of the tcp (or udp) objects available in Max (on
> Windows at least) are capable of doing this. I understand that
> is treated as ASCII "null" character but I would like to see a tcp
> extern that does not treat it as such.
>
> any other pointers?
>
> Quote: barry threw wrote on Tue, 08 May 2007 18:22
> —————————————————-
>> I have a java class for raw TCP communicaton that I just put on my
>> website. It *may* help you. It connects to an arbitrary tcp server.
>>
>> http://www.barrythrew.com/software.html
>>
>> b
>>
>
>
> –
> –
> TBD


Viewing 5 posts - 1 through 5 (of 5 total)