Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[Socket] How do you think of this C# socket class?

http://pastebin.com/tCDmb3bi

Can anyone find some problems for me to fix?
Code
public void Send(String data)
      {
            if (Started)
            {
            if (UseNewLine)
            data += "\r\n";
            // Convert the string data to byte data using ASCII encoding.
            byte[] byteData = Encoding.GetBytes(data);
            m_Socket.BeginSend(byteData, 0, byteData.Length, 0, CallBack_OnSend, null);
            }
      }

Eventually, this will lead to big problems.
What if you need to send over a string that has "\r\n" inside of it? Format the packet differently.
slowly becoming less active, contact me on-site before dealing.
That is the most horrific socket class I've ever seen in my entire life. If I had more time I'd bottleneck it, but it's over 600 lines and over half of them has to be at least deleted or reconstructured. This could have been done much more simpler, but good to see you learning.
(Aug 24, 2014 02:00 PM)beta69 Wrote:  That is the most horrific socket class I've ever seen in my entire life.

nha u havent seen much then 😁
(Aug 24, 2014 02:00 PM)beta69 Wrote:  That is the most horrific socket class I've ever seen in my entire life. If I had more time I'd bottleneck it, but it's over 600 lines and over half of them has to be at least deleted or reconstructured. This could have been done much more simpler, but good to see you learning.

Could you point out wheres the problem instead of telling bulls?


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by lockheadApr 22, 2021 07:10 AM 0 147 Apr 22, 2021 07:10 AM
Last Post: lockhead
[C] by Indie DeveloperJan 13, 2020 01:33 PM 0 184 Jan 13, 2020 01:33 PM
Last Post: Indie Developer
[C] by zapotecsNov 4, 2015 03:55 PM 1 155 Nov 4, 2015 03:55 PM
Last Post: ValiumProp