Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Webmite V5.07.08 betas : UDP and other stuff
Page 3 of 5 | |||||
Author | Message | ||||
TheMonkeys Regular Member Joined: 15/12/2022 Location: AustraliaPosts: 59 |
Execute has broken. From my console log 0?fnw=/.trash/update.bas 1?fin=update.bas 2?act=mv 11:34:36 Rename "update.bas" As "/.trash/update.bas" [228] Execute tmp$ Error : Only single statements allowed The code in question: logIt(tmp$,con+lgf,3) ' log file activities Execute tmp$ The first line prints time$+tmp$ This code was rock-solid until I updated to b2 Also, it now requires option tcp server port 2040 after this error as it seems to lose connectivity. Cheers, Chris |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9128 |
You are not using the code in the way intended which is for the client to make a single request and then receive an answer after which it should close the connection. If you want to keep a connection open then use the new WEB TCP SEND command which doesn't automatically close the connection at the server end |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4043 |
Can we see more code ? What is the value of tmp$ ? Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
TheMonkeys Regular Member Joined: 15/12/2022 Location: AustraliaPosts: 59 |
Hi Tom, it's roughly this. qt$=Chr$(34) If act$<>"" Then Select Case act$ Case "xm" fact$="XMTrim("+qt$+fin$+qt$+")" Case "mv" fact$="Rename "+qt$+fin$+qt$+" As "+qt$+fnw$+qt$ Case "cp" fact$="Copy "+qt$+fin$+qt$+" To "+qt$+fnw$+qt$ Case "rm" fact$="Kill "+qt$+fin$+qt$ Case "dl" dl%=1 fact$="" End Select tmp$=fact$ If tmp$<>"" Then logIt(tmp$,con+lgf,3) ' log file activities Execute tmp$ EndIf EndIf Bear in mind that this code worked perfectly until I updated from 5.0707b0 to 5.0708b2. Edited 2023-06-06 21:38 by TheMonkeys |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9128 |
You need to provide a complete program, as simple as possible, that works on the previous version and fails on this. The code for EXECUTE hasn't changed since 5.07.05 so the problem is elsewhere. Which version are you running on 5.07.07b0? Web or something else? What error message are you seeing? Edited 2023-06-06 21:41 by matherp |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4043 |
... and the value of fin$ and/or finw$ when it chokes ? I recognise you saying it worked in an earlier beta, but it was a beta . Observation: there is another pattern you could use here, instead of the SELECT CASE act$ and EXECUTE do a CALL "cmd_" + act$, arg1$, arg2$ and implement each action as a separate SUB cmd_foo. Peter: As I'm sure you've worked out for yourself I don't think my changes to RUN can have broken this. Best wishes, Tom Edited 2023-06-06 22:54 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
TheMonkeys Regular Member Joined: 15/12/2022 Location: AustraliaPosts: 59 |
See my first post on this problem. As I mentioned, This occurred when I moved from PicoMiteWebV5.07.07b0 to WebMiteV5.07.08b2. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9128 |
Give me a short program that demonstrates the problem and I will look at it and try and fix |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Hi Peter, Can you please comment on this issue? https://www.thebackshed.com/forum/ViewTopic.php?TID=15968&P=2#205084 Thank you in advance. Matthias |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9128 |
I did - see above |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Oh sorry, I had overlooked that! Yes, I have understood this as far as it goes. But my CLIENT (e.g. home-assistant.io) gets the IP of the WebMite entered (socket://192.168.1.77:4000). Unfortunately, it only establishes the connection via TCP and then waits for data from the service (in my case, this should then be the WebMite, I would like to send processed data from a sensor here, for example...). So, as I understand it, WebMite is then the TCP server and reacts to a request, but only receives the interrupt if something has been sent (my problem!) and crashes when continuing to send if the CLIENT (e.g. home-assistant.io) terminates the connection for whatever reason. My TEST code: Dim buff%(4096/8) Print MM.Info(ip address) LongString APPEND buff%(), "Hallo einfach senden" senden=0 WEB tcp interrupt webinterrupt Do Print senden; If senden=1 Then WEB TCP send 1, buff%() EndIf Pause 1000 Loop Sub webinterrupt senden=1 End Sub 1) Start the WebMite 2) Running the programme 3) Client establishes connection (test with ncat instead of home-assistant.io) - ENTER necessary before WebMite starts sending! 4) Exit WebMite (Ctrl-C) ==> no problem Connection ends cleanly, see message in CMD window 5) 2nd test, restart the test programme - ENTER necessary before WebMite starts sending! 6) This time the connection is terminated by the CLIENT (ncat). 7) WebMite crashes, it does not notice the termination. Or what am I doing wrong here? So the two points are, how do I get the status that a connection exists and how do I know that I am no longer allowed to send. Matthias Edited 2023-06-07 20:06 by homa |
||||
nestorjm Newbie Joined: 06/12/2022 Location: ArgentinaPosts: 2 |
The senden variable never goes back to 0 Maybe you could set it back to 0 before the loop statement, so the program stops trying to send data forever. |
||||
TheMonkeys Regular Member Joined: 15/12/2022 Location: AustraliaPosts: 59 |
Apologies to all. Execute wasn't broken, It was a gotcha. I hadn't realised that modifying a parameter within a function/sub modified the variable that was passed to it. Execute threw the error, but the cause was elsewhere. Sorry to waste your time. Cheers, Chris. Function badpath(test$) As integer Local a, path$=test$ ' this fixed the problem For a=Len(path$) To 1 Step -1 If Instr(a,path$,"/") Then Exit For Next a If a>1 Then path$=Left$(path$,a-1) ' this was the problem If Dir$(path$,Dir)="" Then badpath=1 End Function Now that I've fixed MY MISTAKE, I can focus on finishing this... |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Hi Peter, Can you do anything with the description? https://www.thebackshed.com/forum/ViewTopic.php?PID=205317#205317#205317 I've been away for a few days so I'm just asking again. Thanks in advance. Matthias |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9128 |
No - sorry. You are not using the functionality as intended and I have no intention of simulating or replicating what you want. This functionality is fixed other than bugs fixes if issues are found |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Hi Peter, Thanks for your reply. Isn't programming the art of turning commands into new things? But I don't want to argue or philosophise with you. I know English as a foreign language far too poorly for that. That's why I have a hard time with this sentence: "This functionality is fixed other than bugs fixes if issues are found". (Can you express the meaning differently?) In general, the question for you is: do you understand my concern? Actually, the only question I have is how to get the status of a TCP/IP connection in Basic? I wanted to support this with a practical example. But also with the "normal" web server, how do I know in Basic which connection request has which connection status? Thanks for your time. Matthias Edited 2023-06-13 16:17 by homa |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9128 |
You can't. The concept is that the server responds to an incoming request for data. If there is an incoming request then it is axiomatic that a connection exists. After the server responds to the request it, for all commands except the new WEB SEND, closes the connection returning again to a known state. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9128 |
V5.07.08b4 WebMiteV5.07.08b4.zip Installing this version will delete all options This version supports user specified wifi device names and/or static IP addresses OPTION WIFI SSID$, PASSWD$, [NAME$] [,IPADDRESS$, MASK$, GATEWAY$] e.g. option wifi "MySSID","MyPasswd" option wifi "mySSID","MyPasswd","Pico2","192.168.1.118","255.255.255.0","192.168.1.254" option wifi "MySSID","MyPasswd","Pico2" option wifi "MySSID","MyPasswd",,"192.168.1.118","255.255.255.0","192.168.1.254" NB: If NAME$ is omitted then a unique name will be generated of the form "PICOXXXXXXXXXXX where XXXXXXXXXXX is the unique ID of the Pico (? MM.INFO(ID)) Edited 2023-06-15 07:44 by matherp |
||||
Plasmamac Guru Joined: 31/01/2019 Location: GermanyPosts: 554 |
@matherp : i get an error if i try your option wifi "mySSID","MyPasswd","Pico2","192.168.1.118","255.255.255.0","192.168.1.254" example Error : Invalid character: . Edited 2023-06-15 18:52 by Plasmamac Plasma |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9128 |
Set OPTION DISPLAY 64,132 or similar first. You are overrunning the line |
||||
Page 3 of 5 |
Print this page |