Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:38 28 Nov 2024 Privacy Policy
Jump to

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: Australia
Posts: 59
Posted: 01:58am 06 Jun 2023
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 9128
Posted: 07:36am 06 Jun 2023
Copy link to clipboard 
Print this post

  Quote  At the moment I am responding to a WEB interrupt and just remembering that I can send now. This works so far for testing. I can send for minutes, but it needs a character from the client to start - to trigger the interrupt.
As I said, closing the connection from the client side causes a crash, because i am still sending.  


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 Kingdom
Posts: 4043
Posted: 08:45am 06 Jun 2023
Copy link to clipboard 
Print this post

  TheMonkeys said  Execute has broken ...


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: Australia
Posts: 59
Posted: 11:28am 06 Jun 2023
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 9128
Posted: 11:39am 06 Jun 2023
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 4043
Posted: 12:48pm 06 Jun 2023
Copy link to clipboard 
Print this post

... 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: Australia
Posts: 59
Posted: 12:58am 07 Jun 2023
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 9128
Posted: 07:22am 07 Jun 2023
Copy link to clipboard 
Print this post

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: Germany
Posts: 351
Posted: 07:50am 07 Jun 2023
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 9128
Posted: 08:40am 07 Jun 2023
Copy link to clipboard 
Print this post

I did - see above
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 351
Posted: 10:04am 07 Jun 2023
Copy link to clipboard 
Print this post

Oh sorry, I had overlooked that!

  matherp said  
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


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: Argentina
Posts: 2
Posted: 02:14pm 07 Jun 2023
Copy link to clipboard 
Print this post

  homa said  Oh sorry, I had overlooked that!

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


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: Australia
Posts: 59
Posted: 04:41am 08 Jun 2023
Copy link to clipboard 
Print this post

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: Germany
Posts: 351
Posted: 07:16pm 12 Jun 2023
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 9128
Posted: 09:43pm 12 Jun 2023
Copy link to clipboard 
Print this post

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: Germany
Posts: 351
Posted: 06:15am 13 Jun 2023
Copy link to clipboard 
Print this post


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 Kingdom
Posts: 9128
Posted: 07:17am 13 Jun 2023
Copy link to clipboard 
Print this post

  Quote  Actually, the only question I have is how to get the status of a TCP/IP connection in Basic?


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 Kingdom
Posts: 9128
Posted: 09:35pm 14 Jun 2023
Copy link to clipboard 
Print this post

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: Germany
Posts: 554
Posted: 08:51am 15 Jun 2023
Copy link to clipboard 
Print this post

@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 Kingdom
Posts: 9128
Posted: 08:56am 15 Jun 2023
Copy link to clipboard 
Print this post

  Quote  @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: .


Set OPTION DISPLAY 64,132 or similar first. You are overrunning the line
 
     Page 3 of 5    
Print this page
© JAQ Software 2024