Giter VIP home page Giter VIP logo

hazel-networking's People

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  avatar  avatar  avatar  avatar  avatar  avatar

hazel-networking's Issues

How to detect disconnections?

I was wondering how I can detect disconnections.
The wiki from DarkriftNetworking doesn't explain anything. I understand it like it's just straight forward
Connection.Disconnected += Disconnected, but that doesn't work. Also I know this wiki doesn't give any info yet.
So I'm a bit stuck...

Also a sample project would be appreciated!

Does Hazel support TCP?

I see in the included .docx (Hazel Networking Protocol.docx in the root) that there is a TCP implementation:
https://i.imgur.com/b8rYxsN.png

However, this isn't listed in the features list on the main repo page.

Wondering if TCP is supported? And if not, what should I be aware of when working with RUDP, as someone with a TCP background?

Creating several clients in one application causes "Duplicate add MessageReader" exception

After last update i begin to receive this when create two clients in one application

Unhandled Exception: System.Exception: Duplicate add MessageReader
at Hazel.ObjectPool1.PutObject(T item) in /Users/mtiganov/dev/MS.Shaman.Server/Shaman.Server/Network/Hazel/ObjectPool.cs:line 74 at Hazel.MessageReader.Recycle() in /Users/mtiganov/dev/MS.Shaman.Server/Shaman.Server/Network/Hazel/MessageReader.cs:line 128 at Hazel.Udp.UdpConnectionListener.StartListeningForData() in /Users/mtiganov/dev/MS.Shaman.Server/Shaman.Server/Network/Hazel/Udp/UdpConnectionListener.cs:line 131 at Hazel.Udp.UdpConnectionListener.ReadCallback(IAsyncResult result) in /Users/mtiganov/dev/MS.Shaman.Server/Shaman.Server/Network/Hazel/Udp/UdpConnectionListener.cs:line 190 at System.Net.LazyAsyncResult.Complete(IntPtr userToken) at System.Net.ContextAwareResult.CompleteCallback() at System.Net.ContextAwareResult.<>c.<Complete>b__15_0(Object s) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Net.ContextAwareResult.Complete(IntPtr userToken) at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken) at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionCallback(Int32 numBytes, SocketError errorCode) at System.Net.Sockets.OverlappedAsyncResult.CompletionCallback(Int32 numBytes, Byte[] socketAddress, Int32 socketAddressSize, SocketFlags receivedFlags, SocketError errorCode) at System.Net.Sockets.SocketAsyncContext.BufferMemoryReceiveOperation.InvokeCallback(Boolean allowPooling) at System.Net.Sockets.SocketAsyncContext.OperationQueue1.ProcessAsyncOperation(TOperation op)
at System.Net.Sockets.SocketAsyncContext.OperationQueue`1.<>c.<.cctor>b__18_0(Object op)
at System.Threading.ThreadPoolWorkQueue.Dispatch()

How to host using Hamachi?

I know this is not good place to ask but...

How to host using Hamachi?
Apparently you can use server-ip in Minecraft Configuration. But how to do that in Hazel UDP?

(To be exact you can type server-ip on MC Configuration)

Exception: Duplicate add MessageReader

Exception: Duplicate add MessageReader
at Hazel.ObjectPool`1[T].PutObject (T item) [0x00000] in <00000000000000000000000000000000>:0
at Hazel.Udp.UdpConnection.HandleReceive (Hazel.MessageReader message, System.Int32 bytesReceived) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)

(I am using the unity udp client)
Happens only to people in Turkey that use the ISP "turkcell superonline", any idea where I can investigate to get to the root of the issue? after few seconds of connecting to the server they are getting the 6 pings error.
EDIT: I read online that this ISP is using some kind of IPs cluster for their customers, it might be part of the problem, maybe enabling IPv6 would solve it? but the problem is that you can only choose v4 or v6 but not both, in the docs it says you can choose both and I'm not sure how. Thanks!

[Question] What is correct implementation for communicating consoles in other networks?

Hi,

First of all, is this the correct place to ask any questions? If not, tell me the other proper place and forgive please.

I'm working on online multiplay game (up to 4 people) and use Hazel to make P2P communication. I also use Unity.

I'm a newbie about network coding and I don't have confidence that this implementation is right... anyway, I did like below:

I made one console have both of UdpConnectionListener and UdpClientConnection. When host console makes a room via outer matchmake service (and get IP and port number etc.), host does ConnectAsync() to guest consoles. When host's ConnectAsync succeed, guests do ConnectAsync(). Then they can communicate each other.

The problem is:
This implementation works right when all consoles are in the same network. However, when they are in different network, host's or guest's ConnectAsync() doesn't succeed. The status doesn't change "Connecting" to "Connected."
(Curiously, the other side's ConnectAsync() succeeds.)

What should I do to fix this?

I'm sorry about my poor English.
Thank you for any help.

Does Hazel support any form of encryption?

Hey, Forest.

I'm using the Hazel library to develop my MMO video game, and am wondering if it supports any type of high-level encryption. I'm looking for levels of automatic SSL encryption comparable to Secure WebSocket (WSS) or HTTPS. I don't want eavesdroppers to steal my users' credentials, and I do not know if Hazel supports what I'm looking for out of the box.

Is this possible? Thanks

[Bug] A malformed packet can be used to leak old packets

  • MessageReader.GetSized() will return a reader without cleaning the buffer if there is a reader in the reader pool with a buffer that is big enough.
  • MessageReader.ReadString() doesn't do any bound checks. You can supply it any packed integer and it will happily try to read up to 0x7FFFFFFF bytes from the reader buffer. Any value higher than 0xFFFF will cause an exception to be thrown on servers that do not manually specify a buffer size. This issue can also be used to leak old packets. If the server echoes what it reads from the packet back to the client, and if the reader was recycled using MessageReader.GetSized(), the server will send the data of an old packet (probably from a different client) to the client.

Example client code that exploits this and example vulnerable server

Sent 6 pings that remote has not responded to

Hello, I have the library in a game with over 3k daily active users and I get a lot of reports of disconnects.
They get those errors:

  • Sent 6 pings that remote has not responded to.
  • Reliable packet 42 (size=10) was not ack'd after 5090ms (6 resends)

More info:

  • it works if they use VPN
  • I host the server(dedicate server not peer to peer) on Linode in Germany

Most of them are from Turkey, most of the players are able to play fine.
The disconnects happen almost instantly to them(or after few seconds)

Any idea how can I fix it?
Thank you!

[Bug] The server blindly trusts the packet size that is specified in the packet itself

This issue is shares similarities with issue #5 and its impact is the same. Setting a very high packet size will cause MessageReader.GetString() to not throw an exception. Instead, it will happily read the specified amount of bytes, regardless of whether the actual packet contained the said bytes or not. This can be used to leak older packets, and it can be used to cause an exception to be thrown on the client related to out-of-bounds reads.

Client code to exploit this bug
Server code that is vulnerable to this bug

Stack overflow at random times(might be related to DDOS attacks)

Can happen instantly when I start my server, it worked great for a year with no problem but now in the last 24 hours it crashed 10+ times with this weird error:
`Stack overflow.
at Hazel.MessageReader.GetSized(Int32)
at Hazel.Udp.UdpConnectionListener.StartListeningForData()
at Hazel.Udp.UdpConnectionListener.ReadCallback(System.IAsyncResult)
at System.Threading.Tasks.TaskToApm+TaskAsyncResult..ctor(System.Threading.Tasks.Task, System.Object, System.AsyncCallback)
at System.Net.Sockets.Socket.BeginReceiveFrom(Byte[], Int32, Int32, System.Net.Sockets.SocketFlags, System.Net.EndPoint ByRef, System.AsyncCallback, System.Object)
at Hazel.Udp.UdpConnectionListener.StartListeningForData()
at Hazel.Udp.UdpConnectionListener.ReadCallback(System.IAsyncResult)
at System.Threading.Tasks.TaskToApm+TaskAsyncResult..ctor(System.Threading.Tasks.Task, System.Object, System.AsyncCallback)
at System.Net.Sockets.Socket.BeginReceiveFrom(Byte[], Int32, Int32, System.Net.Sockets.SocketFlags, System.Net.EndPoint ByRef, System.AsyncCallback, System.Object)

It goes like this for around 10K lines!
then at the end it says

at Hazel.Udp.UdpConnectionListener.StartListeningForData()
at Hazel.Udp.UdpConnectionListener.Start()
at Prison_Life_Server.ServerProgram.Init(Boolean, Boolean)`

Any idea how can I fix it or can start to investigate? I suspect it might be related to DDOS attack but it happens instantly so I can't even track what message I'm getting.
on Linode I saw at one point I get around 1GBPS for few moments.

And I also have a question what is the benefit of using "ThreadLimitedUdpConnectionListener" instead of the regular one?

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.