Closed FarooqKhattak closed 1 year ago
Try using the IP address of your machine assigned by your router. 127.0.0.1 is a loopback and doesn't get exposed on the network. Make sure your firewall allows the port
Thanks connection is established. and now i copied send message code from repository. but it doesn't recognize it's own methods.
Note: i only installed Tcp.Net.Server package bcz i only need that. my client is my mobile.
Moreover, as we know that i install Tcp.Net.Server package only. so according to the documentation, i should have found the server.asyncStart() method. but unfortunately, i don't have server.asyncStart or Stop method available except those simple Start and Stop methods. Why is that?
Apologies, the documentation is a bit outdated and its on my short-term todos to update it.
Per your image:
Connections is an IEnumerable
The SendToConnectionAsync function is erroring for 2 reasons:
Get rid of Packet and change your message to either string or byte[]
Lastly, TcpListener, which is what is used for the underlying server socket, only exposes Start() and Stop(). They are not async since there is no delay - the socket just opens or closes without waiting for anothre task. Its a synchronous operation to start and stop and TcpListener.
The documentation is old and I need to update it. Apologies again
Thanks for sharing. It is very helpful
On Fri, Apr 14, 2023, 3:27 AM Rob Engel @.***> wrote:
Apologies, the documentation is a bit outdated and its on my short-term todos to update it.
Per your image: Connections is an IEnumerable or IEnumerable
, depending on which server you use. You can do:
- ConnectionTcpServer[] connections = server,Connections.ToArray();
The SendToConnectionAsync function is erroring for 2 reasons:
Packet has been deprecated. The 2 new functions are:
- Task SendToConnectionAsync(string message, Z connection, CancellationToken cancellationToken = default);
- Task SendToConnectionAsync(byte[] message, Z connection, CancellationToken cancellationToken = default);
Get rid of Packet and change your message to either string or byte[]
SendToConnectionAsync is not contained in an async method. Wrap it in a Task -> e.g.
- Task.Run(async () => { await server.SendToConnectiobAsync()});
Lastly, TcpListener, which is what is used for the underlying server socket, only exposes Start() and Stop(). They are not async since there is no delay - the socket just opens or closes without waiting for anothre task. Its a synchronous operation to start and stop and TcpListener.
The documentation is old and I need to update it. Apologies again
— Reply to this email directly, view it on GitHub https://github.com/LiveOrDevTrying/Tcp.NET/issues/7#issuecomment-1507685418, or unsubscribe https://github.com/notifications/unsubscribe-auth/AURBQLNORX5RSI3VDGIXERLXBB4ULANCNFSM6AAAAAAWZ4AFY4 . You are receiving this because you authored the thread.Message ID: @.***>
Hi, I am trying to connect with the server from my phone on ip 127.0.0.1, but i got no socket found exception. although my pc and phone are on the same network too.