Re: requesting some hints and libraries-Csharp

@post 3:
Don't use a byte array this large. Figure out what your packets might be, or gbetter yet attach a length header to your packets being the first two bytes, then read two bytes, see if the length is valid, then try to read that next amount.
I would also recommend splitting up server and client.
@post 4:
There's nothing anywhere that gives these numbers that you say. a 20k byte array is not a security problem, and if so please show proof. I do agree that they can be smaller, see above.
The rest of your information for the most part is your usual misinformed drivvle, please queue your crying and complaints now as I yet again show you why it's wrong.
#2: I agree that there needs to be error handling, look at the exceptions each of these methods throw, but unused imports aren't a problem. It could be cleaned up, but if you've spent any time in .net, you know a lot of these are default and there's no real need to remove them out of hand.
#3: A mutex is not going to solve the problem here. He creates a server and a client, and the client connects to the server. They do not share data, thus no mutex is required. Should they be separate? Certainly, but not for the reasons you recommend. A mutex would not be useful here. There is no deadlock.
recommendations from post 4:
#1: see above about default imports
#2: see above about my packet header information. 1024 isn't a bad number, but it doesn't have to be a max. 2048, 4096, they're all fine (if possibly overkill) Worst case you just read into a stream or something and keep filling it up until you can't read anymore, or just fill a stream and try to parse. There are various ways to handle this. There's no hard rule about a min and a max for a byte array.
#3: Writing an entire function in try catch statements is the exact wrong use of try-catch statements. A try-catch block is strictly to handle exceptions thrown by a method, then maybe clean up with a finally block, not to wrap in an entire function. There could be multiple calls to multiple methods which all throw the same exception, and you would want to potentially handle those differently. Wrapping everything in them is abuse of a tool and will just lead to you silently dropping errors on the floor.
post #5:
There's a time and a place for libraries, some libraries like raknet solve some pretty helpful issues, and networking in general is a really tough thing to get right. I disagree that you should never use libraries, and system.net is hardly a library, it's a wrapper around winsock.
I think what you're saying and what I will second, is that you should understand low-level networking before you jump to using a library to make networking more simple, so I recommend OP continue on this path.
#8:
He's not saying to connect to the driver, he's saying to learn and understand system.net and how sockets in general work before moving on to something else.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Xsense via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Xsense via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Xsense via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Xsense via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : sorressean via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : sorressean via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : sorressean via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ironcross32 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : matt1211 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : sorressean via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : sorressean via Audiogames-reflector

Reply via email to