Search found 34 matches
- Sat Nov 20, 2021 6:56 am
- Forum: General Discussion and Questions
- Topic: Socket receives html code instead of plain text
- Replies: 3
- Views: 1610
- Fri Nov 19, 2021 6:10 pm
- Forum: General Discussion and Questions
- Topic: Socket receives html code instead of plain text
- Replies: 3
- Views: 1610
Socket receives html code instead of plain text
Hi, you are all fine. I wrote a script which first starts in AP mode, asks the user to enter ssid and pasword for the wifi in web form then after restart it starts in station mode and connects to the wifi. Everything works fine, except one thing. When I enter special characters like "!, ', @", etc. ...
- Wed May 06, 2020 1:42 pm
- Forum: General Discussion and Questions
- Topic: asyncio.start_server example (!)
- Replies: 18
- Views: 13149
Re: asyncio.start_server example (!)
Thank you Jomas, waiting for the blank lines solved both the server and the client side communication problems :) At last it worked ! Putting a small delay right after writer.awrite(resp) , solved the problem. The whole working code is : import uasyncio as asyncio import utime async def serve(reader...
- Wed May 06, 2020 12:22 pm
- Forum: General Discussion and Questions
- Topic: asyncio.start_server example (!)
- Replies: 18
- Views: 13149
Re: asyncio.start_server example (!)
I will change the utime.sleep() to asyncio.sleep(). @pythoncoder and @jomas, thank you both for your comments. I can listen to the radio channels pretty well now. Now, I have another problem. I want to control my web radio from a remote web browser, my esp8266 board now works as a (AP) server and (S...
- Tue May 05, 2020 3:59 pm
- Forum: General Discussion and Questions
- Topic: asyncio.start_server example (!)
- Replies: 18
- Views: 13149
Re: asyncio.start_server example (!)
At last it worked ! Putting a small delay right after writer.awrite(resp) , solved the problem. The whole working code is : import uasyncio as asyncio import utime async def serve(reader, writer): t = utime.ticks_ms() resp = b"HTTP/1.0 200 OK\r\n\r\n" + "Ticks = {TICKS}\r\n".format(TICKS=t) l = awai...
- Tue May 05, 2020 3:43 pm
- Forum: General Discussion and Questions
- Topic: asyncio.start_server example (!)
- Replies: 18
- Views: 13149
Re: asyncio.start_server example (!)
Thank you for your comments Peter. Of course, I did not want to send the same sentence to the client 100 times. I noticed that it woks, if I do that. In your code, if I change the iteration to 5 for example, it doesn't work either: Browser says: "Safari Cannot Open the Page Because the Network Conne...
- Tue May 05, 2020 1:40 pm
- Forum: General Discussion and Questions
- Topic: asyncio.start_server example (!)
- Replies: 18
- Views: 13149
Re: asyncio.start_server example (!)
Things getting more and more interesting. The code blow works, sending http header hundred times, when I change the multiplier to, say, 10, it doesn't work. Do you think it is a bug? import uasyncio as asyncio import utime async def serve(reader, writer): t = utime.ticks_ms() resp = b"HTTP/1.0 200 O...
- Tue May 05, 2020 9:07 am
- Forum: General Discussion and Questions
- Topic: asyncio.start_server example (!)
- Replies: 18
- Views: 13149
Re: asyncio.start_server example (!)
Thank you Peter, I will check PicoWeb. I am glad that I did not ask a stupid question
- Mon May 04, 2020 5:53 pm
- Forum: General Discussion and Questions
- Topic: asyncio.start_server example (!)
- Replies: 18
- Views: 13149
Re: asyncio.start_server example (!)
I also noticed that the connections is somehow continues (or suspended), google chrome inspector says
CATION: request is not finished yet
- Sun May 03, 2020 8:31 pm
- Forum: General Discussion and Questions
- Topic: asyncio.start_server example (!)
- Replies: 18
- Views: 13149
asyncio.start_server example (!)
I am trying to write a simple asyncio.start_server example, but it doesn't function properly. import uasyncio as asyncio async def handle_echo(reader, writer): # while (True): data = await reader.read(128) if (data): message = data.decode() addr = writer.get_extra_info('peername') print("Received %r...