atomic web server threads

Share your advanced PureBasic knowledge/code with the community.
User avatar
idle
Always Here
Always Here
Posts: 6214
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

If you want the server visible over lan set the server ip address to the servers ip interface eg 192.168.1.x
Then from your remote pc navigate to 192.168.1.x/indexof

The example I showed will host the files under the folder you create the executable in so set compiler option to create exe in source folder rather than temporary. Create the www folder in that source folder and add your files there.
So for local or lan by ip address the folder structure is
Www/files

If make wget 192.168.1.x/indexof I assume it will fetch all the files as it dynamicly links them.
User avatar
matalog
Enthusiast
Enthusiast
Posts: 322
Joined: Tue Sep 05, 2017 10:07 am

Re: atomic web server threads

Post by matalog »

Idle, that's amazing, thanks. It's almost working.

If I change the port to 80 instead of 8080 on the last program you sent it mostly works.

I will need to change the timeout time because my ZX Spectrum doesn't get the entire 6MB image within the time your server allows. It seems to get about 1.2MB of the 6MB image in the case that I am testing.

Where is the timeout time set? In The 'atomic_web_server3.pbi' file or the new indexing file you sent?
User avatar
idle
Always Here
Always Here
Posts: 6214
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

matalog wrote: Sun Feb 22, 2026 1:24 am Idle, that's amazing, thanks. It's almost working.

If I change the port to 80 instead of 8080 on the last program you sent it mostly works.

I will need to change the timeout time because my ZX Spectrum doesn't get the entire 6MB image within the time your server allows. It seems to get about 1.2MB of the 6MB image in the case that I am testing.

Where is the timeout time set? In The 'atomic_web_server3.pbi' file or the new indexing file you sent?
I don't think it will be the server timing out that's 15000 default and is updated every time data is sent
you can try

wget --timeout=15 --tries=5 -r --follow-tags=a http://192.168.1.x

I don't know why the forum is so slow probably AI bot crawlers.
User avatar
matalog
Enthusiast
Enthusiast
Posts: 322
Joined: Tue Sep 05, 2017 10:07 am

Re: atomic web server threads

Post by matalog »

matalog wrote: Sun Feb 22, 2026 1:24 am I don't think it will be the server timing out that's 15000 default and is updated every time data is sent
you can try

wget --timeout=15 --tries=5 -r --follow-tags=a http://192.168.1.x

I don't know why the forum is so slow probably AI bot crawlers.
Yes, if I increase the timeout (or all instances of 15000) in "atomic_web_server3.pbi" then it transfers entirely, but the download doesn't finish nicely.

When it is finished, the spectrum would usually say file saved, but with this server, it just hangs on the progress bar.

Is there an alternative way to terminate the data transfer?
User avatar
idle
Always Here
Always Here
Posts: 6214
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

I don't know what's going on you can debug the requests
also when it doesn't know the file type it defaults the mime type to "text/html"

what is wget requesting? maybe that will shed some light on the issue

Code: Select all

;call back for get and post  
Procedure CBPostGet(*request.Atomic_Server_Request) 
  
  
  Debug *request\Type 
  Debug *request\Request
  
  Debug "params:" 
  
  ForEach *request\parameters()
    Debug MapKey(*request\parameters()) + " = " + *request\parameters()
  Next 
  
  Debug "headers:" 
  ForEach *request\RequestHeaders() 
    Debug MapKey(*request\RequestHeaders()) + " = " + *request\RequestHeaders()
  Next   
    
EndProcedure   

Global server1 = Atomic_Server_Init("atomic_webserver","./www/","127.0.0.1","",80,#PB_Network_IPv4,5000,@CBPostGet(),@CBPostGet()
User avatar
matalog
Enthusiast
Enthusiast
Posts: 322
Joined: Tue Sep 05, 2017 10:07 am

Re: atomic web server threads

Post by matalog »

That code change didn't debug much. It just said "/s.jpg".

I have tried jpgs, which I think is a known file type, png and bmp.

They all don't finish on the Spectrum. I noticed that when I exit the server then the Spectrum says "File Saved" and ends correctly.

Is there a way to have the server simulate the program closing when the download is finished?
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5673
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: atomic web server threads

Post by Kwai chang caine »

Waouh !!! your site is splendid !!! understated and classy :shock: i love it 8)
I have run the PB code and it say the 80 port is occuped :oops: and i not believe have another curent server
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
idle
Always Here
Always Here
Posts: 6214
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

Shouldn't be an issue on windows but linux will block port 80 unless it's run elevated.
Last update was for pb 6.20 though I'm using 6.30 and also tested 6.40 with minor change.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5673
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: atomic web server threads

Post by Kwai chang caine »

Waouh...waoouuuuh and I would even say ...waoouuuuh !!! :shock:

Before i use the 6.21 x86 :wink:
With 6.30....that works exactely like on your site :shock: but in my home at me :mrgreen:

I can't believe how beautiful it is! 8)
But i not dare to look into your WEB code :oops: , surely a plane with powerful library, for can do this splendids effects 8)
It's a real change from my Web 1.0 sites with inline style :lol:

Code: Select all

<body bgcolor="#006600">
		<div style="text-align:center; margin:20px"><img src="/Donnees/Medias/Images/Vignettes/Vignette1.jpg" width="450" height="675"></DIV>
		<div style="text-align:center; text-shadow:6px 6px 8px black; font-size:40px; color:white; margin-bottom:100px">1 - Ambulance (4221)</div>
		<div style="text-align:center; margin:20px"><img src="/Donnees/Medias/Images/Vignettes/Vignette2.jpg" width="450" height="372"></DIV>
		<div style="text-align:center; text-shadow:6px 6px 8px black; font-size:40px; color:white; margin-bottom:100px">2 - Animaux de la forêt (3006)</div>
		<div style="text-align:center; margin:20px"><img src="/Donnees/Medias/Images/Vignettes/Vignette3.jpg" width="450" height="370"></DIV>
		...........................
Tim Berners-Lee would be surely proud of KCC :mrgreen:

Image

i'm always the CERBER of his original language :D

Image

Thanks a lot MASTER for this great and amazing sharing 8)
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
idle
Always Here
Always Here
Posts: 6214
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: atomic web server threads

Post by idle »

Hi Kcc
The html template is Hyperspace by HTML5 UP
html5up.net Free for personal and commercial use under the CCA 3.0 license
infratec
Always Here
Always Here
Posts: 7811
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: atomic web server threads

Post by infratec »

Post Reply