de en es fr
Let the machine help
Light teasing, exhibition, BDSM, sissyfication, watersports... with sounds and pictures


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 issue with send/receive
PostPosted: Fri Mar 09, 2018 6:20 pm 
Offline
Veteran
User avatar
Code:
def msg="hi\nhow are you"
show(msg)
send("xxx.msg",msg)
wait(5)
msg=receiveString("xxx.msg")
show(msg)


output is:

hi
how are you
<5 second wait>
hi

we loose anything after the \n when sending,
is there a way around that?


Top
 Profile Send private message 
 
 Re: issue with send/receive
PostPosted: Fri Mar 09, 2018 6:46 pm 
Offline
Site Admin
User avatar
This is not the normal behaviour. I'll look for this bug this evening or tomorow


Top
 Profile Send private message 
 
 Re: issue with send/receive
PostPosted: Fri Mar 09, 2018 7:04 pm 
Offline
Veteran
User avatar
running on macOS if it helps

_________________
"If you don't gosub a program loop, you'll never get a subroutine."


Top
 Profile Send private message 
 
 Re: issue with send/receive
PostPosted: Fri Mar 09, 2018 11:21 pm 
Offline
Addict
Hi lifeinplymouth,

it's just a wild guess about a possible cause of your problem.

The '\n' is cast into a newline (Code 0x0a) when generating the string.

If 'send()' does use get-variables this would conclude the request. When getting it back, only the 'hi' would be there.

You could check two things.

Change your code to

Code:
def msg="hi\\nhow are you"
show(msg)
send("xxx.msg",msg)
wait(5)
msg=receiveString("xxx.msg")
show(msg)


In this case '\\n' would be cast into '\n' on the first string-assignment. So you should see a '\n' in the screen output. When you get the string back from the server, this '\n' should in my opinion be replaced by a true newline, so you should have a linebreak after 'hi'


If this works, you could check, if urlencoding your string helps. Off yourse you have to decode the string when you get it back. For this change your code to

Code:
def msg="hi\nhow are you"
show(msg)
msg = URLEncoder.encode(msg)
send("xxx.msg",msg)
wait(5)
msg=URLDecoder.decode(receiveString("xxx.msg"))
show(msg)


I'd like to hear if this did the trick.


Top
 Profile Send private message 
 
 Re: issue with send/receive
PostPosted: Sun Mar 11, 2018 3:22 pm 
Offline
Site Admin
User avatar
It was indeed a bug on the server, corrected


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010 - 2020
This website uses session cookies only.