FirstGearGames
❔ Socket.Connected for listening sockets?
The Socket class contains a
Connected
property, but not Listening
. I'm trying to check for a break in connectivity when a socket is listening.
EG: if a client connects to a server then Connected
is true, and will become false when the client disconnects.
I'm not finding an equivalent for when the server is listening, or if the socket is somehow dropped.6 replies
❔ Passing around thread to perform work on?
I'd like to call a method that runs on the main thread but offloads a portion of it's work onto a passed in thread.
Here's a stripped down version of what I'm looking to accomplish...
I'm not 100% sure on the best way to go about this.
5 replies
HashCode randomly changing on structures.
I've never in my career of coding have seen the behavior I'm about to describe so I'm hoping to learn something new... this is Unity3D btw...
In my code I am iterating a collection built on creation. I've confirmed that the objects are not being rebuilt at any time, and also the GetHashCode shown in this segment returns the same every time. The code below does not really matter a whole lot, just showing my work flow.
This is the SetIsKinematic method....
What's strange is whenever
_rigidbody.Velocity
(a structure) contains value the GetHashCode returns different. EG: if _rigidbody.velocity
is Vector3.zero
the hashcode is the same as what was called during the loop, but if it differs the hashcode does as well. I've found simply changing the struct to a class resolves the issue but I'm not sure why.
The read velocity
segment also always has the correct hashcode either way.14 replies