SuperSockets [C#] Hold up to 10K connections.

Page 1 of 2 12 LastLast
Results 1 to 25 of 27
  1. #1
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    SuperSockets [C#] Hold up to 10K connections.


    ! UPDATED Download: Pack.rar

    Information
    SocketListener using async, events and pooling. (Very Stable)

    Read the 'README' :)

    Credits
    50% Microsoft (Doing examples how to create)
    50% Me (Doing te codes)

    Example(s)

    Pooling
    Code:
            internal SocketAsyncEventArgs Pop()
            {
                lock (this.Pool)
                {
                    return this.Pool.Pop();
                }
            }
    
            internal void Push(SocketAsyncEventArgs item)
            {
                lock (this.Pool)
                {
                    this.Pool.Push(item);
                }
            }
    Async Accepting
    Code:
            private static void WaitForAsync(SocketAsyncEventArgs Args)
            {
                if (Args == null)
                {
                    Args = new SocketAsyncEventArgs();
                    Args.Completed += new EventHandler<SocketAsyncEventArgs>(AcceptAsync_Completed);
                }
                else
                {
                    Args.AcceptSocket = null;
                }
    
                SocketSemaphore.WaitOne();
    
                BaseSocket.AcceptAsync(Args);
            }
    
            private static void HandleAsync(SocketAsyncEventArgs Args)
            {
                try
                {
                    Interlocked.Increment(ref ConnectedAmount);
    
                    var SingleSocketAsync = SocketPool.Pop();
                    var Token = (AsyncUserToken)SingleSocketAsync.UserToken;
    
                    Token.Socket = Args.AcceptSocket;
    
                    var Session = new Session(Interlocked.Increment(ref Counter), Token.Socket, Args);
    
                    Sessions.Add(Session.Id, Session);
    
                    if (!Args.AcceptSocket.ReceiveAsync(SingleSocketAsync))
                    {
                        HandleReceive(SingleSocketAsync);
                    }
                }
                catch { }
                finally { WaitForAsync(Args); }
            }

    Like if you like!


    I use this in (Boolean) : http://forum.ragezone.com/f331/proje...63a-os-808457/
    Last edited by Squard; 09-01-12 at 07:07 PM.


  2. #2
    Lurking since '06 1ntel is offline
    MemberRank
    Jul 2006 Join Date
    401Posts

    Re: SocketListener + Sockets C# [Events, Async, Fast, Hard]

    Well done Wichard, not bad!!! and guys, SocketAsyncEvents is what REALLY holds 10k+ connections in C#

    Why you still using internal btw, do you know what that actually does?

    EDIT: Took a quick look, im sad :(, your not doing it all correctly your missing a few very important things, your not allocated the buffer at startup so its all in the same memory space (the buffer space is handed out to clients on read/write request, it doesn't create a buffer for each use, acts like a buffer pool)


    EDIT 2: Why don't you just make use of SuperSocket? It does everything else for you, just import the project solution into your project as dependencies then use it :D

    Otherwise look here:
    http://www.codeproject.com/KB/IP/soc...eventargs.aspx
    Last edited by 1ntel; 09-01-12 at 06:31 PM.

  3. #3
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: SocketListener + Sockets C# [Events, Async, Fast, Hard]

    Quote Originally Posted by matty13 View Post
    Well done Wichard, not bad!!! and guys, SocketAsyncEvents is what REALLY holds 10k+ connections in C#

    Why you still using internal btw, do you know what that actually does?

    EDIT: Took a quick look, im sad :(, your not doing it all correctly your missing a few very important things, your not allocated the buffer at startup so its all in the same memory space (the buffer space is handed out to clients on read/write request, it doesn't create a buffer for each use, acts like a buffer pool)
    You should help me: wichardriezebos@live.nl

  4. #4
    Lurking since '06 1ntel is offline
    MemberRank
    Jul 2006 Join Date
    401Posts

    Re: SocketListener + Sockets C# [Events, Async, Fast, Hard]

    Quote Originally Posted by Squard View Post
    You should help me: wichardriezebos@live.nl
    Already got you on msn but your not online to me.

  5. #5
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: SocketListener + Sockets C# [Events, Async, Fast, Hard]

    I finished the BufferManager.

    Quote Originally Posted by matty13 View Post
    Already got you on msn but your not online to me.
    With BufferManager: Transmission.rar

    Very stable ;D

  6. #6
    Banned Divide is offline
    BannedRank
    Aug 2011 Join Date
    British CoderLocation
    1,013Posts
    Ooh, thanks. Now the users who buy my emulator wont complain about a limit of 5k :/

    Sent from my mobile via Tapatalk.

  7. #7
    ส็็็็็็็ Bloodraven is offline
    MemberRank
    Sep 2009 Join Date
    AntarcticaLocation
    2,414Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Got to say its looking really good.

  8. #8
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Quote Originally Posted by -Jordan- View Post
    Got to say its looking really good.
    Thanks :D

  9. #9
    Account Upgraded | Title Enabled! Muscab is offline
    MemberRank
    Oct 2009 Join Date
    264Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    I read this thread and truly had a long, ever lasting giggle. Let's hit 300 online before we start worrying about 10,000 online mk?

  10. #10
    hoi ik ben cool Merijn is offline
    MemberRank
    Dec 2009 Join Date
    The NetherlandsLocation
    492Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    So, i can now hit up 10.000 players? =D

  11. #11
    Account Upgraded | Title Enabled! DoctorCooper is offline
    MemberRank
    Oct 2011 Join Date
    R:\aGEZONELocation
    317Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    This is awesome, Thanks mate :)

  12. #12
    hoi ik ben cool Merijn is offline
    MemberRank
    Dec 2009 Join Date
    The NetherlandsLocation
    492Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Quote Originally Posted by Muscab View Post
    I read this thread and truly had a long, ever lasting giggle. Let's hit 300 online before we start worrying about 10,000 online mk?
    Actually, agreed.
    This socket will be fine for people that's making their own MMOCC. Having great dedicated servers, and super sockets. But on Habbo Retro's is it almost not reachable.

    Habbo NL - Almost 6k players at a day
    Habbo COM - 10k

    So, how the fuck would a Retro Hotel reach 10k players? i don't know.

  13. #13
    C# | C++ Emerica is offline
    MemberRank
    Oct 2010 Join Date
    GermanyLocation
    437Posts
    Quote Originally Posted by MerijnZ View Post
    So, i can now hit up 10.000 players? =D
    Think about your Mysql Query's etc too!
    Posted via Mobile Device

  14. #14
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Quote Originally Posted by Muscab View Post
    I read this thread and truly had a long, ever lasting giggle. Let's hit 300 online before we start worrying about 10,000 online mk?
    We're talking about huge amounts. Matty said up to 10K so i believe an more experienced coder.

    Quote Originally Posted by Emerica View Post
    Think about your Mysql Query's etc too!
    Posted via Mobile Device
    Thats all to you. Some dumbs like: Meth0d created his own Pooling.

    MySQLConnector includes his own pooling thats very better. Using MySQLHelper.

  15. #15
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,484Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    It's the actual mysql server that processes all the queries. The emulator tells to server to process these queries. :)

    So if you get alot of lag from running too much queries, it's the mysql server, not the emulator.

  16. #16
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Quote Originally Posted by Quackster View Post
    It's the actual mysql server that processes all the queries. The emulator tells to server to process these queries. :)

    So if you get alot of lag from running too much queries, it's the mysql server, not the emulator.
    Theoretically, anything is possible.

  17. #17
    The one and only! Hejula is offline
    MemberRank
    Nov 2008 Join Date
    4,128Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Quote Originally Posted by MerijnZ View Post
    Actually, agreed.
    This socket will be fine for people that's making their own MMOCC. Having great dedicated servers, and super sockets. But on Habbo Retro's is it almost not reachable.

    Habbo NL - Almost 6k players at a day
    Habbo COM - 10k

    So, how the fuck would a Retro Hotel reach 10k players? i don't know.
    Habbo Principal - Nearly 40k players a day. 10k is reachable but not at this day in age. Maybe 2 years or so, as already we see hotels like Sunnieday getting nearly 3000 daily.

    But like this - it supports 10k connections for when needed, it is better to code it for large numbers of connections as it would not need re-coding when your hotel expands.

  18. #18
    hoi ik ben cool Merijn is offline
    MemberRank
    Dec 2009 Join Date
    The NetherlandsLocation
    492Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Quote Originally Posted by Davidaap View Post
    your believing that sunniedays online count is 100% real? ;)
    A lot of people? Tim is just an faggot.

  19. #19
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Anyone tested those sockets? Yes they are functionally. but i mean tested on high amount(s).

  20. #20
    :joy: Jonteh is offline
    MemberRank
    Apr 2007 Join Date
    New York, USALocation
    3,372Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Quote Originally Posted by MyKi View Post
    Wanna know something funny, well not 'funny' but eh, some hotels like German Hotels they get like 6, 000 users on line, if there lucky, and no they don't run on Phoenix Emulator, no they don't run on Butterfly or anything else like that, they actually run on there own UberEdit server, and it's very stable. And I mean very stable! All the games work, all the pets work (not horses) and you know, it goes to show, if you do take effort into making or editing an emulator, you can achieve a great goal.
    But people who sell emulators closed source, like Aaron, and whoever else, are just pricks who are tr0lls looking for cash for there shit-ass UBER edits! And I remember, a few years ago, we had some great coders, but the section has fallen apart, and all we have is like 3-4-5 actually good coders, it's really sad to see this happen. Now-a days everyone who develops things prefer to keep it to themselves because there afraid that people would say shit about there work like it's crap, it's sad really, because when someone releases something, there releasing it so that YOU can use it, or in hope that it's useful for some, or all.
    So I personally think that this section needs a big clean-up, I'm just saying. Because if someone goes to release something, and one person doesn't like it, the'll give all this negative comments, but remember, this is a development section, Habbo Hotel section, Help section, Tutorial section, everyone is just trying to help out, even if it's the littlest bit.
    It would be great if people showed at lease some consideration about others in this section. It's really sad to see what has developed over time. We really need to start to act like our age, not 10 year old trolls trying to get a epenis or anything like that, we should appreciate for what we have! / Thank you for reading, much appreciated.

    -MyKi
    Who are you? You registered last month. You have no idea what you are talking about.

  21. #21
    Lurking since '06 1ntel is offline
    MemberRank
    Jul 2006 Join Date
    401Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Quote Originally Posted by Squard View Post
    Anyone tested those sockets? Yes they are functionally. but i mean tested on high amount(s).
    Its a step forward but the code isn't 100% complete, there is still tons missing from it at moment :)

  22. #22
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Quote Originally Posted by matty13 View Post
    Its a step forward but the code isn't 100% complete, there is still tons missing from it at moment :)
    What are you missing ?

  23. #23
    Proficient Member office.boy is offline
    MemberRank
    Feb 2007 Join Date
    156Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Perhaps 1000 users max (and 1000 is probably pushing it) on good hardware and code (e.g. Netty). Anything after that, i'd imagine you'd have to load-balance and route to several server instances and SQL clusters.

  24. #24
    Proficient Member Squard is offline
    MemberRank
    Dec 2011 Join Date
    155Posts

    Re: SuperSockets [C#] Hold up to 10K connections.

    Quote Originally Posted by office.boy View Post
    Perhaps 1000 users max (and 1000 is probably pushing it) on good hardware and code (e.g. Netty). Anything after that, i'd imagine you'd have to load-balance and route to several server instances and SQL clusters.
    I heard netty is java. This is not java my friend.

  25. #25
    Alpha Member Caustik is offline
    MemberRank
    May 2011 Join Date
    LondonLocation
    1,837Posts
    Quote Originally Posted by Squard View Post
    I heard netty is java. This is not java my friend.
    Mike was using netty as an example...
    Posted via Mobile Device



Page 1 of 2 12 LastLast

Advertisement