OSC

Posted By: MMike

OSC - 01/28/08 23:08

hello

I have a appllication that is sending data packets to a specifyc ip AND port: 3333

Each line that is sending is like a string that contains intructions.

What i want to do it to make GStudio read and show me what string is recieving by that port with that Ip..

is this very hard to code?
I really need this.
Posted By: PrenceOfDarkness

Re: OSC - 01/28/08 23:12

I'm gonna give it a wild guess and say you will need to write a plugin to link the two together. The level of difficulty would depend on your understanding of whatever language you use.
Posted By: MMike

Re: OSC - 01/29/08 00:05

well the application send text sentence over and over, with values
And i want GS to read that string to i can work later with the values..

really need a plugin? i do little C++
Posted By: PrenceOfDarkness

Re: OSC - 01/29/08 00:58

u can also save it to a file and import it that way but i imagin that will slow it down alot
Posted By: MMike

Re: OSC - 01/29/08 20:51

But isn't this a UDP socket question? does gs work with UDP ports and TCP IP?..?
Posted By: PrenceOfDarkness

Re: OSC - 01/30/08 04:06

The only way I know of going straight to your application would be a DLL. If you don't want to use a DLL the save the info to a file . I know it's a pain in the ass but that's what we all have to do
Posted By: MMike

Re: OSC - 02/01/08 17:32

ok thanks.. anyway saving is too slow for a realtime application
Posted By: MMike

Re: OSC - 02/01/08 17:33

i want 3gs to connect to a server just that.... socket connection more specificaly
Posted By: nfs42

Re: OSC - 02/01/08 18:07

do you have any protocol defintion or a sample app to check ?
Posted By: MMike

Re: OSC - 02/01/08 19:56

Well i will explain me better:

I have a c++ program running. That program is sending socket packets as strings, like:

New point:5.2
New point:5.1
New point:5.6
New point:2.4

(...)
So it sends to a port (3000) ip: 127.0.0.1

Now.. i need Gs to read that messages.. and update a 3dSG string that will be the flow of messages from the server.
Posted By: nfs42

Re: OSC - 02/01/08 21:52

here is a small console app to test your sending app
Posted By: MMike

Re: OSC - 02/01/08 22:35

its not working.. im sending to a 127.0.0.1 IP and a 3000 port..
Posted By: nfs42

Re: OSC - 02/01/08 22:57

works for me, with gstnet=udp based
Quote:


Ready to receive on port 2300
Received 48 bytes from: 192.168.178.24:2780
)
Received 48 bytes from: 192.168.178.24:2780
)
Received 48 bytes from: 192.168.178.24:2780
)




run with: server.exe 3000
Posted By: MMike

Re: OSC - 02/01/08 23:10

hum changed to server 3000, didn't know i could use the 3000 command.. but even though it won't work. The Ip is not my Ip! its a runtime created ip server.. With your appl, i can't use a ip tag like the one you told me before to change port?


or ..maybe the messages i recieving aren't UDp ...
~but knowing..that the application is sending OSC messages to a java application that then sends the same message to a virtual created server on port 3000.. and The messages recieved from the java app, are from port 3333..

is there anything i could try to intercept the messages at such 3000 port?
Posted By: MMike

Re: OSC - 02/01/08 23:26

ok.. The appl i have is sending messages for LOCALhost.. port 3000 ...
Your apppl server.exe reads nothing..
Whats wrong?
Posted By: nfs42

Re: OSC - 02/01/08 23:37

the app is a udp server listening on the defined port on the actual machine
that's the lan ip of my machine !
ip server, you mean a dns server ?
you should know what protocol is used ;-)
weher is your app running ? on the same machine as your java app, can you config the java app?
Posted By: MMike

Re: OSC - 02/01/08 23:52

ok went testing with a different program...
Your appl works fine when i send text to the UDP.

What is easier to implement in Gstudio TCP or UDP?
The final iam is read a string ( message) from a USp or TCP message "emitter"



Posted By: MMike

Re: OSC - 02/02/08 00:01

Can you write a simple gs c-script code that allow me to read what messages are being sending to that a port.. can be 2300 on a local machine?
Posted By: nfs42

Re: OSC - 02/02/08 10:02

udp/tcp is socket based, so no problem with win32.
udp is unreliable, but on sender/listener on the same machine should'nt give any problems.
i'll change this code for use as a 3DGS-Plugin.
Posted By: MMike

Re: OSC - 02/02/08 14:30

OK i tested my appl with your console using the UDP as sending type, and it works.. it says.. recieved 200 bytes from: 127.0.0.1:51594 #bundle

Ahum.. that bundle thing i can't do nothing with that :S

but if i use the java program with the my first program, this java one will convert the message recieved from port 3333 (UDP) to TCP and send it to localhost port 3000.. and a string will apear with "xml code" argumentss and stuff that i can then use

But for the best, it would be nice to add a select port and select ip, and select method connection funcionalilty
Posted By: nfs42

Re: OSC - 02/03/08 22:36

try first beta of GSTSocket
Posted By: MMike

Re: OSC - 02/08/08 02:05

well it can send UDP .. but im not getting how to recieve.. what i have right now is this..


function read_udp {

if (!GSTSocket_udp_bind(5000)){
str_cpy(inco,"sender opened"); //display in a runtime text string
} else {
str_cpy(inco,"sender failded");
}


while(1) {
GSTSocket_udp_poll(sResult);
if(str_len(sResult)>0) {
str_cpy(inco,"recieved:") ; //show what recieved

str_cpy(sResult, ""); // show what is recieving
str_cpy(inco,sResult)

wait(1)}

}



The thing is that im getting no recieving ... cause it says.. sender failed
Posted By: MMike

Re: OSC - 02/08/08 02:31

ok i got it to work now..

string recieve="waiting";
function getread{

GSTSocket_udp_bind(5000); //Set port

while(1) {

GSTSocket_udp_poll(recieve);
str_cpy(inco,recieve);
wait(1);
}

}


on_f getres;
Posted By: MMike

Re: OSC - 02/08/08 02:39

But what about the TCP can it be done too?

By the way your plugin is gona help alot of people i hope.
Posted By: MMike

Re: OSC - 02/08/08 04:19

Because with TCP i will get string text (XML flowing..)
And with UDp i just get a text saying #bundle :s
Posted By: nfs42

Re: OSC - 02/08/08 07:47

it's possible.
i'm busy this weekend.
so you have to wait 'til next week.
Posted By: MMike

Re: OSC - 02/08/08 14:27

HUm ok. your work is really helping me out. since i have no visual studio right now to do my own plugins
Posted By: MMike

Re: OSC - 02/08/08 21:27

anyway i got a way to use udp already via flash and Gs
Posted By: MMike

Re: OSC - 02/13/08 22:52

About your plugin..
HUm.. when i leave the engine it gives me error?
maybe caused by the port left open? and terminate suddently. ?
© 2024 lite-C Forums