Code Monkey home page Code Monkey logo

easytcp's People

Contributors

ablizorukov avatar dependabot[bot] avatar job79 avatar maarten-baert avatar thijsk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

easytcp's Issues

Can Connect local, but not from outside network

Servus from germany, again...

i am using your ActionServer and ActionClient. Both are fully functionally, if i initialize the Server with server.Start(999) and connect the client via client.Connect("127.0.0.1", 999, TimeSpan.FromSeconds(1000));.

But if i want to connect to a specific (public) ip address outside of the clients network, it throws an exception, because it's unable to find the server. Any Ideas why? Did i miss something?

2 bytes missing in Server_OnDataReceive

static void Main(string[] args)
{
       EasyTcpServer server = new EasyTcpServer();
       server.OnDataReceive += Server_OnDataReceive;
       server.Start(8080);
            
       while (true)
       {
           System.Threading.Thread.Sleep(100);
       }
}

private static void Server_OnDataReceive(object sender, EasyTcp3.Message e)
{
      string request = Encoding.ASCII.GetString(e.Data, 0, e.Data.Length);
      string req = e.ToString(Encoding.ASCII);
}

If you run this code and navigate to 127.0.0.1:8080 with chrome then request and req will start with
T / HTTP/1.1\r\nHost: 127.0.0.1:8080\r\nConnection: keep-alive\r\n
instead of
GET / HTTP/1.1\r\nHost: 127.0.0.1:8080\r\nConnection: keep-alive\r\n
This is not about string, byte[] Data has 2 bytes less than it should.

Can't install package

Hi,

I tried downloading this package from NuGet package Manager in Visual Studio 2019 and i get this error:

"No se pudo instalar el paquete 'EasyTcp 3.5.0'. Está intentando instalar este paquete en un proyecto que tiene '.NETFramework,Version=v4.7.2' como destino, pero el paquete no contiene referencias de ensamblado o archivos de contenidocompatibles con dicho marco. Para obtener más información, póngase en contacto con el autor del paquete."

From what i understand i should change my NetFramework Version in the project i'm using. Is this correct?

No "Send"-Method avaiable. :(

Greetings from germany,
i was using your EasyTcp NuGet Package 2.0.4.2 for my current project, before i was forced to change my target framework to .NET Framework. So i now use your newest Version of EasyTcp, Version 3.7.8.
Well, i enjoyed really the "server.Send(Socket client, byte[] data)" Method in the Server-Class for sending Data zu specific Clients.

Why did you removed that feature? Or do you have still implemented it somewhere else? My Application has got a chat function. If i use "SendAll" i have to check on each client, if this message is avaiable for it. That would be not as elegant as your "Send" Method.

Anyway, THANK YOU for creating this Package, but can u help me with this one?

EDIT: I tried to install EasyTcp.Actions, but i get this error:
"EasyTcp 3.7.8' is not compatible with 'EasyTcp.Actions 4.0.0 Restriction: EasyTcp (>= 4.0.0-beta)'.
But there is no EasyTcp 4.0.0 Beta...

EDIT2: i finally got an earlier Version of EasyTcp.Actions and have noticed the cool new feature with SendAction. But still no Method for Sending expecially to ONE client :(

Release v4

What is the current timeline for publishing the 4 version of EasyTcp as non-beta?
Are there any technical issues holding back a release, or is it just the lack of documentation?

Regards,
Thijs

EasyTcpActionServer() Crashes "Could not load actions: could not find any EasyTcpActions"

Hello I have a new issue. I try to make a EasyTcpActionServer but it crashes with this error: Could not load actions: could not find any EasyTcpActions

I looked in examples but I couldn't find any working solution.

this is my sourcecode:

        static void Main(string[] args)
        {
            using var server = new EasyTcpActionServer().Start(5472);
            server.OnConnect += (sender, client) => Console.WriteLine($"Client connected [ip: {client.GetIp()}]");
            server.OnDisconnect += (sender, client) => Console.WriteLine($"Client disconnected [ip: {client.GetIp()}]");
            server.OnUnknownAction += (sender, message) => Console.WriteLine("Unknown action received");
            Console.WriteLine("Server is Up!");

           
        }

        [EasyTcpAction("PING")]
        public void PingAction(ActionMessage message)
        {
            Console.WriteLine("GOT PING ACTION");
        }

        [EasyTcpAction("ACTIVATE")]
        public void ActivateAction(ActionMessage message)
        {
            Console.WriteLine("Got Activation request");
        }

Create documentation

Create a website with documentation for basic usage of EasyTcp, EasyTcp.Actions, EasyTcp.Encryption and EasyTcp.Logging

Examples project is deprecated and should be removed after documentation is finished

PrefixLengthProtocol filling Message.Data with null/empty data

Client: PHP 7.4 on Ubuntu 20.04.1 LTS, Amazon EC2.

Can confirm that when the request is around 3KB, framing fails and OnDataReceive is fired at least twice. The first Message.Data is the correct content length, but actual real content is only around 78%, the remaining 22% is empty/null and when converted using .ToString() is turned into white space. The 2nd invocation of OnDataReceive creates a Message.Data that's around 16KB that contains the remaining data from the original request (minus a couple of bytes in the beginning) and a whole lot of white space. Client.EndPoint is identical in both OnDataReceive. In my client code, the socket is written to only once, and the number of written bytes is the correct length (~3kb). Requests smaller than 3kb don't seem to exhibit these bugs.

The same code works fine when the client is on a macOS. I've switched to DelimiterProtocol since which works more reliably.

SSL Certificates

hey sorry for opening new issue.
How can i make a Valid Server SSL Certificate i tried it with XCA software but it says its invalid

Exceed 64K limit packet size?

Hello.

I use EasyTcpServer with .NET Core console and Topshelf to install it as a Windows Service.
I face the problem with the size of the package exceeding 64k and I get an overflow exception. I need to mention that I have no control over the client implementation.

My code looks like:
this.TCPServer = new EasyTcpServer(new EasyTcp3.Protocols.Tcp.DelimiterProtocol("\x004", autoAddDelimiter: false, autoRemoveDelimiter: false, encoding: Encoding.UTF8));
this.TCPServer.OnDataReceive += TCPServer_OnDataReceive;

And on the receive event I have something like:
var DataReceived = e.ToString();

Is there a way to configure the library to support large amount of data in this scenario?
Thank you.

Client disconnecting issue

Hello,
First of all i really like this project and i hope it will be maintained as long as possible.
I tried to implement this extension in my project, witch sends and receives alot of packets, but i experienced some client disconnecting issues.
After some digging i managed to isolate the issue and make a simple example witch reproduce the issue (see the code below).

using EasyTcp4.ClientUtils;
using EasyTcp4.Protocols.Tcp;
using EasyTcp4.ServerUtils;
using System;
using System.Diagnostics;

namespace eTCPTest
{
    internal class Program
    {
       static EasyTcpServer server;
       static EasyTcpClient client;
        static void Main(string[] args)
        {
            //server
            server = new EasyTcpServer();
            server.Protocol = new PlainTcpProtocol(1024);
            server.Start(888);
            server.OnDataReceive += Server_OnDataReceive; //We subscribe to this event to send echo replies to simulate some traffic

            //client
            client = new EasyTcpClient();
            client.Protocol = new PlainTcpProtocol(1024);

            if (client.Connect("127.0.0.1", 888)) //Making sure we are connected to server
            {
                int NotConnectedCounter = 0;
                int ConnectedCounter = 0;
                for (int i = 0; i < 1000000; i++)
                {
                    if (client.IsConnected())
                    {
                        client.Send("AAA");
                        ConnectedCounter++;
                    }
                    else
                    {
                        NotConnectedCounter += 1;
                    }
                }
                Console.WriteLine("Not Connected Count:" + NotConnectedCounter.ToString() + "\r\nConnected Count:" + ConnectedCounter.ToString());
            }
            else
            {
                Console.WriteLine("Cannot connect");
            }
        }

        private static void Server_OnDataReceive(object sender, Message e)
        {
            server.SendAll(e.Data); //echo reply
        }

    }
}

Normal output should be: Not Connected Count: 0 Connected Count: 1000000
But here's some actual ouputs:
Not Connected Count: 999353 Connected Count: 647
Not Connected Count: 999485 Connected Count: 515
Not Connected Count: 999372 Connected Count: 628
Not Connected Count: 999313 Connected Count: 687

For the most of the time client.IsConnected() returns False, and it actually disconnects from the server.
If i remove the connection check it works just fine.
Also if we unsubscribe from OnDataReceived (to disable the echo replies) also works just fine.
Maybe i'm doing something wrong.

How to use EasyTcp with winform?

Hi.
This project so brilliant. But example not clear enough to me
I'm new in winform, can any one create some example with winform?
Ex: How to count connecting clients, How to change text from a label when OnDatareceive event happen
Thanks for any help!

EasyTcpClient.SendAndGetReply() does not unsubscribe event if timeout occurs

Here: https://github.com/GHenkje/EasyTcp/blob/master/EasyTcp/Client/EasyTcpClient.cs#L470

If the timeout were to occur, reply would be returned as null, but the event is not unsubscribed. If the message were to be received after this method already returned, the event handler will also throw an ObjectDisposedException at signal.Set();, which may crash the program unexpectedly with little debug info.

Even if no message is received, signal and reply (as well as the event handler) are prevented from being garbage collected, meaning you have a very small memory leak if the timeout occurs.

Add documentation how to run

That's very important to describe how to run, the server should be listening and shouldn't just die after the run.

Beside adding while (true) (which is not in the doc also) maybe there are some ways to run and keep running it?

Also, please, add some examples

PrefixLengthProtocol in v4.x is is not compatible with itself depending on max message size

Prior to version 4.x PrefixLengthProtocol used just two bytes to encode message length which was limited to 65535 bytes. Since version 4.x header length is chosen based on max message length, which means that clients and server must be strictly versioned together. Furthermore, I am not even sure if it is clear for new users that changing max message length from say 50000 to 100000 bytes will likely break things. So I suggest to have just one version with of PrefixLengthProtocol which always uses four bytes to encode message length, as two byte overhead is such small and insignificant. For users migrating from 3.x which might need to have backward compatibility there could be special static method to create such instance or just different obsolete class.

in EasyAction event handler method, can not call form controll??

.netFramework 4.7.2
tcp server code:

public partial class EasyTcpServerForm : Form
    {
        private EasyTcpActionServer server;

        public EasyTcpServerForm() {
            InitializeComponent();
        }

        private void EasyTcpServerForm_Load(object sender, EventArgs e) {
            output("formload");
            server = new EasyTcpActionServer();
            server.Start(8000);
            server.OnConnect += (sender1, client) => {
                System.Net.Sockets.Socket socket = client.BaseSocket;
                string remote = IPAddress.Parse (((IPEndPoint)socket.RemoteEndPoint).Address.ToString ()) + "on port number " + ((IPEndPoint)socket.RemoteEndPoint).Port.ToString ();
                string local = IPAddress.Parse (((IPEndPoint)socket.LocalEndPoint).Address.ToString ()) + "I am connected on port number " + ((IPEndPoint)socket.LocalEndPoint).Port.ToString ();
                output($"OnConnect: remote ip:{remote}, local ip:{local}"); // it is normal here
            };
        }

        [EasyAction("ECHO")]
        public void EchoAction(EasyTcp4.Message message) {         
            message.Client.Send("response ECHO xxx");
            System.Net.Sockets.Socket socket = message.Client.BaseSocket;
            string remote = IPAddress.Parse (((IPEndPoint)socket.RemoteEndPoint).Address.ToString ()) + ", on port number " + ((IPEndPoint)socket.RemoteEndPoint).Port.ToString ();
            string local = IPAddress.Parse (((IPEndPoint)socket.LocalEndPoint).Address.ToString ()) + ", I am connected on port number " + ((IPEndPoint)socket.LocalEndPoint).Port.ToString ();
            output($"OnEchoAction: message:{message},remote:{remote}"); // This will throw an exception: InvalidOperationException
        }

        public void output(string str) {
            this.Invoke(new Action(() => {
                this.textBox1.AppendText(str + Environment.NewLine);
            }));
            System.Diagnostics.Debug.WriteLine (System.Threading.Thread.CurrentThread.ManagedThreadId + str);
        }
    }

Disconnect/reconnect getting multiple copies of data

So I have set up my client with a connect and disconnect method. I have my server set up to transmit two sets of data (strings) whenever a client connects.
When I connect the first time, it works as expected. However, if I disconnect, then reconnect I get two copies of each message coming into the client.
Debugging through shows that I am only asking the server to transmit the two pieces of information on this reconnect.
So why am I receiving four when I reconnect?
If I disconnect/reconnect again I get six, and so on and so on.

SSL Server gets crashed by NonSSL client connecting and closing

Hi when i connect with a NonSSL client to SSL Server and the client crashes cause it cant talk to the server, the server also crashes with the following error:

[2023-07-13 15:32:39.8632] [Fatal] Error Message: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
Stack Trace: at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
at System.Net.Security.SslStream.g__InternalFillHandshakeBufferAsync|189_0[TIOAdapter](TIOAdapter adap, ValueTask`1 task, Int32 minSize)
at System.Net.Security.SslStream.ReceiveBlobAsync[TIOAdapter](TIOAdapter adapter)
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
at System.Threading.Tasks.TaskToApm.End(IAsyncResult asyncResult)
at System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)
at EasyTcp4.Encryption.Ssl.SslProtocol.<>c__DisplayClass15_0.b__0(IAsyncResult ar)
at System.Threading.Tasks.TaskToApm.TaskAsyncResult.InvokeCallback()
at System.Runtime.CompilerServices.TaskAwaiter.<>c.b__12_0(Action innerContinuation, Task innerTask)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()
at System.Threading.Tasks.AwaitTaskContinuation.<>c.<.cctor>b__17_0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.<>c.b__128_1(Object state)
at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()

is there a way to prevent the server from crashin? i tried to hadle the issue with the On Error event but it still crashes

Send an object to the server

Hello, I'm really great about what you did here. It's really easy to work with.
But I have one question: The client sends an action like this:

client.SendAction ("USER", "Hello everyone");

I would like to send a class object to the server, e.g.

client.SendAction ("USER", MyCLass);

and the method like this;

[EasyAction("USER")] // Trigger function when "USER" action is received
public void EchoAction(Message message)
{
    MyClase user = message as MyClass
    user.name 
}

is that possible?

Nuget?

All of the EasyTcp packages were unlisted from nuget. What happened?

Disconnection issue

Hi,
I'm running into issues with my client.
The client works fine in a LAN, once internet is involved they send a few packages back and forth, then suddenly the BaseSocket of the client returns null. I don't directly acces the basesocket anywhere, always using the easytcp client and server to handle that for me.
On average packages are sent once every second.
Am i missing something?

Thanks in advance!
Edit: reformulated to be less verbose and more to the point.

How can we handle this Exception when running server?

hi @Job79 . I'm using 2.04 version. Sometime this exeption make program crash.
Can you provide some help?

`Application: WhatDogService.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Net.Sockets.SocketException
at EasyTcp.Server.EasyTcpServer.NotifyOnError(System.Exception)
at EasyTcp.Server.ServerListener.OnReceiveData(System.IAsyncResult)
at System.Net.LazyAsyncResult.Complete(IntPtr)
at System.Net.ContextAwareResult.CompleteCallback(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Net.ContextAwareResult.Complete(IntPtr)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(System.Object, IntPtr)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

`

Exceed 64K limit packet size?

Hello,

If you're using the EasyTcp4.0.0-beta version from nuget.org the problem with the size of the package exceeding 64k reappears.
The previous local nuget you sent me is working fine but the beta version still has that bug.

Thank you.

PrefixLengthProtocol

Hello. I wish to use EasyTcpClient to connect to existing GameServer which uses protocol simillar to PrefixLengthProtocol but with 2 bytes length included in packet/message. Is there any simple workaround?

Example:
GameClient sends: 5 0 0 0 0
EasyTcpClient sends: 5 0 0 0 0 0 0

can we run on old .netframework version?

HI @Job79 .
I have a question about compatible user client.
They always use old system that only using .netframework 4.0, or 4.5
Can we low down requirement about this library and EasyEncypt library ?
Now this only running in netframework 4.7+
So many user can't run this deployed app

Extra Encoding Characters on Send

Just thought I would let those know who want to send a string of hex values that Send() will not work correctly as it adds 2 encoding characters. to address this I sub-classed EasyTcpClient and create a Send_Buffer(byte[] data) method. and ConvertHexStringToByteArray() method. Here is the code:

    class easyTcpClient:EasyTcpClient
    {
        public void Send_Buffer(byte[] data)
        {
            if (data == null) throw new ArgumentNullException("Could not send data: Data is null.");

            else if (Socket == null) throw new Exception("Could not send data: Socket not connected.");

            byte[] message = new byte[data.Length + 2];

            Buffer.BlockCopy(BitConverter.GetBytes((ushort)data.Length), 0, message, 0, 2);

            Buffer.BlockCopy(data, 0, message, 2, data.Length);

            using (SocketAsyncEventArgs e = new SocketAsyncEventArgs())
            {
                e.SetBuffer(message, 0, message.Length);

                Socket.SendAsync(e);//Write async so it won't block UI applications.
            }
        }

        public static byte[] ConvertHexStringToByteArray(string hexString)
        {
            if (hexString.Length % 2 != 0)
            {
                throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "The binary key cannot have an odd number of digits: {0}", hexString));
            }

            byte[] data = new byte[hexString.Length / 2];
            for (int index = 0; index < data.Length; index++)
            {
                string byteValue = hexString.Substring(index * 2, 2);
                data[index] = byte.Parse(byteValue, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
            }

            return data;
        }
    }

I called it as follows:

        byte[] bytes = easyTcpClient.ConvertHexStringToByteArray("0D30");

        client.Send_Buffer(bytes);

Nathan

Stop Server

is it possible to stop the server without closing the console or winform?

Client send a unknowed header.

Hi All,
sorry for my bad english, at first..

I'm tryng to use Henkje library on a vb.net project (library was downloaed by nuget, version is 2.04) but i have a strange result.
Try to explain:
i've defined and start the connection, but all data i send to server, when received have a 1 chr prefix... in example: if i send
$OKMAP-V02;T;GM8-FAKEAGM_8;9.96574;45.01765;664;05/11/2019 12:03:02;19;134;0;3
the server receive
O$OKMAP-V02;T;GM8-FAKEAGM_8;9.96574;45.01765;664;05/11/2019 12:03:02;19;134;0;3;
or
P$OKMAP-V02;T;GM8-FAKEAGM_8;9.96574;45.01765;664;05/11/2019 12:03:02;19;134;0;3;
or some other chr prefix on string..

Note: I've used different TCP socket servers, but always i have same result...

Hope my explain is understandeable...

I dont attach the code because is very simple... just you have to know i hav to connect and close connection on each data transmit.

Any answer is appreciate.
Thanks.

I get SocketException on server Start()

If I run the sample code for EasyTcpActionServer in README I get an exception. I am on .NET Framework 4.7.2

System.Net.Sockets.SocketException: 'Only one usage of each socket address (protocol/network address/port) is normally permitted'

This exception was originally thrown at this call stack:
System.Net.Sockets.Socket.DoBind(System.Net.EndPoint, System.Net.SocketAddress)
System.Net.Sockets.Socket.Bind(System.Net.EndPoint)
EasyTcp4.ServerUtils.StartUtil.Start(T, System.Net.IPEndPoint, bool, System.Net.Sockets.Socket)
EasyTcp4.ServerUtils.StartUtil.Start(T, ushort, System.Net.Sockets.Socket)

Received packets send by `SendLargeArray` contains invalid data/bytes

There is some problem with read bytes from message. Some bytes are replaced by other or even removed.

Example:

  • Send from client client.SendLargeArray(buffer, false, false) where buffer contains 40 bytes.
  • Receive packet on server with OnDataReceive. Resulting packet will contains only 36 bytes. I.e. 4 bytes was consumed somewhere in chain leading to corrupted data on the end.

Another example:

  • Send from client client.SendLargeArray(buffer, false, true) where buffer contains 40 bytes.
  • Receive packet on server with OnDataReceive. Resulting packet will contains 40 bytes, but last two bytes were removed and two bytes [00, 00] were inserted at begning. Again - leading to corrupted data.

In addition to all above. Using SendLargeArray results in instant disconnect from server after sending message.

System.Security.Cryptography.CryptographicException: m_safeCertContext is an invalid handle.

When using trusted SSL Cert, client connects fine first try, but then when another connection is received, this exception is thrown.

Unhandled exception. System.Security.Cryptography.CryptographicException: m_safeCertContext is an invalid handle.
   at EasyTcp4.EasyTcpServer.FireOnError(Exception exception)
   at EasyTcp4.Encryption.Ssl.SslProtocol.OnConnectCallback(SocketAsyncEventArgs ar)
   at EasyTcp4.Encryption.Ssl.SslProtocol.<StartAcceptingClients>b__12_0(Object _, SocketAsyncEventArgs ar)
   at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
   at System.Net.Sockets.SocketAsyncEventArgs.OnCompletedInternal()
   at System.Net.Sockets.SocketAsyncEventArgs.ExecutionCallback(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationAsyncSuccess(Int32 bytesTransferred, SocketFlags flags)
   at System.Net.Sockets.SocketAsyncEventArgs.CompletionCallback(Int32 bytesTransferred, SocketFlags flags, SocketError socketError)
   at System.Net.Sockets.SocketAsyncEventArgs.AcceptCompletionCallback(IntPtr acceptedFileDescriptor, Byte[] socketAddress, Int32 socketAddressSize, SocketError socketError)
   at System.Net.Sockets.SocketAsyncContext.AcceptOperation.InvokeCallback(Boolean allowPooling)
   at System.Net.Sockets.SocketAsyncContext.OperationQueue`1.ProcessAsyncOperation(TOperation op)
   at System.Net.Sockets.SocketAsyncContext.ReadOperation.System.Threading.IThreadPoolWorkItem.Execute()
   at System.Net.Sockets.SocketAsyncContext.HandleEvents(SocketEvents events)
   at System.Net.Sockets.SocketAsyncEngine.System.Threading.IThreadPoolWorkItem.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Unsure if this is a bug or not, would like confirmation if it's an issue with my own code. Code:

public static async Task StartServer(ushort port)
        {
            uptimeTime.Start();

            try
            {
                API.LogEntry("Starting Server...", "Server");
                TCPServer.UseServerSsl(new X509Certificate2(GlobalVariables.Certificate, GlobalVariables.CertPass)).Start(port);

                if (TCPServer.IsRunning)
                {
                    uptimeTime.Stop();
                    API.LogEntry($"Server Up In {uptimeTime.ElapsedMilliseconds}ms. On Port {port}", "Server");

                    TCPServer.OnConnect += TCPServer_OnConnect;
                    TCPServer.OnDisconnect += TCPServer_OnDisconnect;
                }
                else
                {
                    API.LogEntry("Program Cannot Continue.");
                    Environment.Exit(1);
                }

                await Task.Delay(-1);
            } catch (Exception e)
            {
                API.LogEntry($"Server Failed To Start.\n{e}");
            }
        }

Server is running on a Linux Oracle Cloud Instance.

Could not load actions: class with EasyTcpAction doesn't have have parameterless constructor

The examples
https://github.com/Job79/EasyTcp/blob/master/EasyTcp3/EasyTcp3.Examples/Actions/ActionsExample.cs
and
https://github.com/Job79/EasyTcp/blob/master/EasyTcp3/EasyTcp3.Examples/Actions/AuthorizationExample.cs
will both throw me this error:
error

I did copy the code from the examples 1:1 and added using EasyTcp3; as a using but I couldn't get it running

EasyTcp version: 3.6.3
EasyTcp.Actions version: 2.5.2
Net Framework: 4.7.2

Edit: This only happens if EasyTcp is called from inside a library.

  1. I made a test library (Net Framework 4.7.2)
  2. I did copy the content inside of it
  3. I did create a Console Application (NET Framework 4.7.2)
  4. I did call the functions inside the library from the Console Application

IPv6 in not working correctly

Hello, I am trying to remotely connect to an EasyTcp server that is running on my local machine. When using the loopback i have no problem connecting to it, but when i try to use my public ipv6 it just wont connect. Am i missing something or am i doing something wrong here?

Client Connect
client.Connect("2***:****:*:**:****:***:****:****", 1133, TimeSpan.FromSeconds(1));

Server Start
server.Start(IPAddress.Any, 1133, 1000);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.