DO IT!! this is exactly what I'm hoping the netsend~/netreceive~ objects will encourage!
So, make it "foo 49;" -- it's the semicolon that terminates a message. It would be good to put a "\n" character at the end so that it looks better when you print the stream out.
As to getting a return value, netsend~ doesn't wait for a response; you have to handle that by "netreceive~" -ing a return code.
cheers Miller
On Mon, Dec 04, 2000 at 07:02:23PM -0500, Dan Neveu wrote:
Hello, I'm essentially a c++ novice, so bare with me. I'm currently learning OpenGL on linux and would like to stream data to and from Pd. I'm aware of GEM, but would like to have the possibility of collaborating with those OpenGL programmers whom have no intention of learning Pd. There's also the possibility of incorporating it into a 3D Cave project being conducted by the media studies department here.
I'm trying to utilize this class which I found (libtcp++) in order to provide tcp client capabilities to my GL code: http://www.sashanet.com/internet/download.html
For now, I'm mainly determined to get the OpenGL-to-Pd connection working. So far, I've succeeded in creating the libtcp build, importing and instantiating a tcp_client object, and establishing a connection with Pd (netreceive outputs "1" upon execution of the graphic app). But I haven't figured out how to format the data in order for it to be received.
The tcp_client send fuction is as follows:
int TcpClient::send(char* data, int num_bytes) { return write(socket_fd, data, num_bytes); }
My call to 'send' is:
net->send(data, sizeof(data)); //net is my instantiated tcp object
based on this, I had to convert number data from the GL code to string before passing it. I tried both passing the data string alone (e.g. "49") as well as concatenating it with a name to be recognized by a Pd receive object (e.g. "foo 49").
What has to be reformatted in order for this to work?
Thanks, Dan