1. get() - GET_FAIL x GET_EOF
- Posted by martin.stachon at worldonline.cz Apr 20, 2001
- 398 views
This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C0C9D4.8BF346C0 charset="iso-8859-2" Hi all why value("{1,") gives GET_EOF, but value("{1") gives GET_FAIL ? I'm writing chat program. The exchange of messages could be done with = sequences : client will send something like {myname,message,other_info}. The server = will read buffer and then decide : GET_SUCCES =3D> process message GET_FAIL =3D> error, ignore this message, send warning to client GET_EOF =3D> whole message not sended yet, read the buffer again Should I use some special char after the end of sequence ? Thanks ------------------------ Regards, Martin Stachon ------=_NextPart_000_0012_01C0C9D4.8BF346C0 Content-Type: text/html; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-2" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3D"Arial CE" size=3D2>Hi all</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Arial CE" size=3D2><FONT face=3DCourier><FONT=20 face=3D"Arial CE">why</FONT></FONT></FONT></DIV> <DIV><FONT face=3D"Arial CE" size=3D2><FONT face=3DCourier><FONT=20 face=3D"Arial CE"> </FONT>value("{1,") </FONT>gives <FONT=20 face=3DCourier>GET_EOF, </FONT><FONT face=3D"Arial = CE">but</FONT></FONT></DIV> <DIV><FONT face=3D"Arial CE" size=3D2> <FONT = face=3DCourier>value("{1")=20 </FONT><FONT face=3D"Arial CE">gives </FONT><FONT = face=3DCourier>GET_FAIL=20 ?</FONT></FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>I'm writing chat program. The exchange = of=20 messages could be done with sequences :</FONT></DIV> <DIV><FONT face=3DArial size=3D2>client will send something like <FONT=20 face=3DCourier>{myname,message,other_info}. </FONT><FONT face=3D"Arial = CE">The=20 server will read buffer and then decide :</FONT></FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Arial CE" size=3D2>GET_SUCCES =3D> process = message</FONT></DIV> <DIV><FONT face=3D"Arial CE" size=3D2>GET_FAIL =3D> error, ignore = this message,=20 send warning to client</FONT></DIV> <DIV><FONT face=3D"Arial CE" size=3D2>GET_EOF =3D> whole message not = sended yet,=20 read the buffer again</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Arial CE" size=3D2>Should I use some special char = after the end=20 of sequence ?</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3D"Arial CE" size=3D2>Thanks</FONT></DIV> <DIV><FONT face=3D"Arial CE" = size=3D2>------------------------<BR>Regards,<BR>Martin=20 ------=_NextPart_000_0012_01C0C9D4.8BF346C0--
2. Re: get() - GET_FAIL x GET_EOF
- Posted by Ted Fines <fines at macalester.edu> Apr 20, 2001
- 418 views
In get.e, the GET_ trio are defined as: global constant GET_SUCCESS = 0, GET_EOF = -1, GET_FAIL = 1 Try this code: include get.e puts(1,"ONE>" & sprintf("%d",value("{1,")) & "<ONE" & "\n") puts(1,"TWO>" & sprintf("%d",value("{1")) & "<TWO" & "\n") puts(1,"TRE>" & sprintf("%d",value("{1,2,")) & "<TRE" & "\n") puts(1,"FOR>" & sprintf("%d",value("{1,2")) & "<FOR" & "\n") puts(1,"FIV>" & sprintf("%d",value("{1,2}")) & "<FIV" & "\n") puts(1,"SIX>" & sprintf("%d",value("{A,")) & "<SIX" & "\n") I get this result: C:\>ex test ONE>-1<ONE TWO>1<TWO TRE>-1<TRE FOR>1<FOR FIV>0<FIV SIX>1<SIX This makes sense to me... I can see how the code would read the comma in ONE, expect another element, and not finding one return a GET_EOF. Whereas it merely fails with no closing curly bracket. Not that I'm justifying it, but I can see how it would work like this...Seems like it might make more sense if an ending comma or missing curly bracket would return the same result. Anyway, if the behavior is consistent, you should be able to find a way to work with it... Ted --On Friday, April 20, 2001 8:00 PM +0200 martin.stachon at worldonline.cz wrote: > > > > Slim down your email inbox. And firm up your newsletter flow > with My Topica's email newsletter organizer. It's free of > charge, free of calories. No dieting required! > > > Hi all > > why > value("{1,") gives GET_EOF, but > value("{1") gives GET_FAIL ? > > I'm writing chat program. The exchange of messages could be done with > sequences : client will send something like {myname,message,other_info}. > The server will read buffer and then decide : > > GET_SUCCES => process message > GET_FAIL => error, ignore this message, send warning to client > GET_EOF => whole message not sended yet, read the buffer again > > Should I use some special char after the end of sequence ? > > Thanks > ------------------------ > Regards, > Martin Stachon > >
3. Re: get() - GET_FAIL x GET_EOF
- Posted by martin.stachon at worldonline.cz Apr 21, 2001
- 398 views
Ted writes: > Anyway, if the behavior is consistent, you should be able to find a way to > work with it... > > Ted Yes, i'll add CR after sequence, but i must send characters as numbers because sequence may contain CR too, like this: {{12,23,45},{12,34,45}}CR