#Client stops sending the data when sending it after the first data sent
1 messages · Page 1 of 1 (latest)
Client stops sending the data after sending the first data
Client stops sending the data when sending it after the first data sent
cant help without code
blocks preferably
oh ok wait for some seconds
oh your hello world message isnt receiving?
Use codeblocks to send code in a message!
To make a codeblock, surround your code with ```
To use C# syntax highlighting add cs after the three back ticks.
For example:
```cs
Console.WriteLine("Hello World");
```
Produces:
Console.WriteLine("Hello World");
To send lengthy code, paste it into https://paste.myst.rs/ and send the link of the paste into chat.
is the code visible?
this one is for server
client
@regal badger @quick osprey codes uploaded
the issue is that there's no loop inside handleClient in server.py so after first message, it exits and doesnt take data from the socket
I am using thread and it's under while loop
As per my debugging, I think there's nothing wrong with server but I may be wrong
def handleClient(conn, addr):
while True:
msg = conn.recv()
print(msg)
if msg == DISCONNECT_MESSAGE:
conn.close()
print("Connection broken")
return
your "accept connection" is in a while loop
not receiving messages
that loop with the threads just allows multiple clients to connect to the server
so I dont need the accept function under the loop?
idk... depends
if you only want a client to connect once and then the server stops... then you dont need accept function under a loop
but if you want the server to keep accepting new connections, you still want the loop there
yup I want to since I will be testing with multiple clients
yeah then leave that as it is
just that the handle client threads need to be in a loop as well to keep reading messages sent
ok soo upon removing the accept method from loop it works
but keeping it inside the loop breaks it again
what are you doing 😄
you just have to put a loop inside handleClient
everything else is fine
this
Now I genuinely feel dumb, This was the problem all along 🤦♂️
@quick osprey thanks for the solution, I appreciate it
no worries
@chilly karma your code will not support the client sending a lot of data simultaneously
It's fixed💀, it was a simple fix that my brain can't figure out
But thanks to everyone who helped tho appreciate it