✅ TcpClient is connected to TcpListener but TcpListener isn't connected...
so this is how i accept clients which passes through with no issues. i've made to sure to catch any errors that could result from function and none is thrown...
this is how the client attempts to connect to the server. this result in a successful connection.
my pc is the server while my phone is the client. they're in the same network but i havent touched the firewall settings in my pc yet but i assume that wont cause this issue...
16 Replies
AcceptClient
returns false?nope it returns a valid TcpClient
Sorry so what's the problem then 😅 ?
TcpListen.server.conneced is false
which prevents me from sending data to clients
even an error is thrown when i try to use NetworkStream.write about socket not being connected
tbf i should've took a screenshot when i saw that 😅
Tcplistener.Server.Connected
will return false because you do close the server here Server.Stop();
oh i thought that would only block any outside connection attempts
while already accepted clients remain connected
Afaik yes, already accepted clients will remain connected, you have to close them seperatly, but still
Tcplistener.Server.Connected
will return false
when the listener server is stoppedhmmm ig that makes sense
i'll test rq. can i ping you back when something comes up?
Yea feel free to
and i doxxed my self...cool
just a sec 😅
@.kouhai. here we go
so yeah connected is still false 🫤
it seems like TcpListener.Server.Connected will always return false because Socket.Connected determins whether the socket is connected to remote host or not, but the actual listener isn't connected to the client.
The TcpClient returned from
AcceptTcpClientAsync
should be checked instead of the TcpListener itselfhmmm but dont you need both sockets to be connected to send information?
oh yeah that makes sense! the tcplisten cant be connected to it's own socket
yep that's probably it! thanks a lot kouhai 😅
Np
i just checked and the remote client is indeed connected. i appreciate your help 🙏