... he already answered the question. The issue is NOT with the sockets.
That's where the error starts because the stack trace BEGINS WHEN YOU RECEIVE A PACKET.
The TOP is where the actual error is.
'Index was outside the bounds of the array'. This means you're trying to pull from a collection a value which DOES NOT EXIST.
Example would be.... pulling a monster type which is not loaded by the server or any other number of things.
Follow the error through and you should find somewhere it's pulling from a collection and place above that an...
if(Collection.Contains(value))
pull value
Should fix the issue.
Note: Depending on what the code is, it may need a else return (or using boolian logic you could just do... if(!Collection.Contains(Value)) return