Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 19:35 03 Jan 2025 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 : TCP server and WebMite Release - V6.00.01

Author Message
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 392
Posted: 11:47pm 29 Dec 2024
Copy link to clipboard 
Print this post

okay, a few questions about TCP servers

I want to write a TCP server in Basic and use it to provide a service.
If I set ‘OPTION TCP SERVER PORT n’ I can define an interrupt routine ‘WEB TCP INTERRUPT’ in the programme.
In this routine, data from the TCP stream is then transferred with
  FOR a% = 1 To MM.INFO(MAX CONNECTIONS)
    WEB TCP READ a%, buff%()
is read. I can find out the active connection number by checking with ‘LLEN(buff%())=0)’.
Unfortunately I cannot read the requesting/sending IP?
Then I would like to respond to the request. If I use ‘WEB TCP SEND cb%, data%()’ for this and do not close the connection (‘WEB TCP CLOSE cb%’), it is closed after a while by a timeout? ‘Warning: No response to request from connection no. 1’
Because sending after this message leads to ‘Warning: LWIP send data timeout’

How do I keep control of the TCP connection?

WEB TCP SEND ... It just sends exactly what is in the LONGSTRING data%() and it
is up to the Basic programmer to close the connection when appropriate.



Do I always have to wait for a connection through the interrupt? And do I get status messages in the MM variables? Similar to UDP?


What exactly is this ‘OPTION WEB MESSAGES ON/OFF’ for?
And is there a list with a short explanation of all WEB messages?

As I said, just a few small questions about TCP ;-)

Matthias
 
Malibu
Senior Member

Joined: 07/07/2018
Location: Australia
Posts: 245
Posted: 11:04pm 30 Dec 2024
Copy link to clipboard 
Print this post

  Quote  WEB TCP SEND cb%, data%()

Not sure where the cb% is coming from, you should be sending it to a%, the connection number that the web stream came in on.
AFAIK, I think you'll be getting your warnings because you're trying to send/close a connection that isn't there.
You can't 'control' the connection. It's only there when a HTTP request comes in.
The senders IP is usually part of the incoming stream (Not always though)
John
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2025