Flash/Blitz Basic
Blitz3D Forums/Blitz3D Beginners Area/Flash/Blitz Basic
| ||
Sorry, i'm an user of BB for 2 weeks now and i'm wondering 'bout the network's use. I'm trying to program an XmL SocKet server for flash and i can't. I suppose flash send bytes 2 by 2 and i can't read the message from the stream, can someone light me, please?.... |
| ||
Hi and welcome to the Blitz world. As far as I know, you can build up your own comunication protocol, and deal with the stream you want to read. So if your Xml socket server should read some byte per time, I think it's completely doable from within Blitz. Take a look to the stream and readbyte commands. Hope it helps a bit, Sergio. |
| ||
yes i've already done it, the problem i've got is situate in the flash transfer protocol, i can only read the half of the message sended by flash when i use readbyte and the other is that, when i use it, the server ""bugs"", windows sent me that the program not responds for 20 sec.(I got this problem with a telnet client because of the difference between readline$ and readstring, also, the server gets nothing with these commands and flash.... :p Dam'n. I can't express myself correctly in english... |
| ||
Send your flash code and Blitz code and I'll have a look at it. |
| ||
flash: -------------------------------------------------------- on (release) { function myOnConnect(success) { if (success) { userxml= new XML ("<new>"+nom+"</new>"); socket.send(userXML); gotoAndStop ("main"); } else { info= "Connection failed!"; } } socket = new XMLSocket(); socket.onConnect = myOnConnect; if (!socket.connect("127.0.0.1", 10000)) { info= "127.0.0.1 :"+port+"Connection failed!"; } } (Work exept that i can only read one byte each two bytes) --------------------------------------------------- flash MAIN: on (release) { msgXML= new XML ("<msg>"+msg+"</msg>"); socket.send(nomXML); } ------------------------------------------- socket.onXML = lire; function read(tampon) { chat += "--------------" } (HEre each won't work....) --------------------------------------------- Blitz Code: srv=CreateTCPServer(port) If srv=0 Then Print "Impossible de créer une connect@" Else While Not KeyHit(1) acc=AcceptTCPStream(srv If acc Print "Nouveau connecté Print "**********************" While Not Eof (acc) byt=ReadByte(acc) If byt>0 And ReadAvail(acc) Then Print Chr(byt) WriteByte acc,byt EndIf Wend EndIf Wend |
| ||
??????????????????????????????????????????? |
| ||
Wow I would help but i don't know action script very well. |
| ||
I just need to know how can i receive the variables from flash. It's too strange, it seem that flash sends the bytes by 2 and i can only read only the half of my message. Can somebody help me, i'm planning to make a rpg online and i need it in time... please. |
| ||
This is only a guess, but if flash sends 2 bytes at a time then maybe you need to use ReadShort instead of ReadByte and WriteShort instead of WriteByte. |
| ||
Yes thanks I will try that... |