Results 1 to 5 of 5

Thread: Reusable socket server library or built into code ?

  1. #1
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 11
    Location
    South Africa
    Posts
    865

    Reusable socket server library or built into code ?

    Hi all,
    I've wanted to make a small IRC server for ages now, but each time I attempt to code it I get stuck on the networking part. I always want to build a massive socket server library that is multithreaded and can do connections on more than one port and handle all the sending and receiving, but now I am starting to doubt it's benefit vs cost. Is it wise to use a library for networking instead of building it directly into the application itself ?

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  2. #2
    Frenzied Member Evil_Giraffe's Avatar
    Join Date
    Aug 02
    Location
    Suffolk, UK
    Posts
    1,879

    Re: Reusable socket server library or built into code ?

    Depends what you mean. For my money, I'd want to code the IRC server logic as handling a sequence of incoming messages, parsing them, responding to them and passing out messages. There would be no socket or networking code involved in this. I would have a separate piece of the server that dealt with socket connections and reading/writing data off those connections. I wouldn't consider this part as a 'library', it's simply supporting infrastructure to the code. It would use a library in the form of the .NET Sockets class and IO namespace generally. However, to be a library implies it can be packaged up and used by different applications - this code would simply do what the IRC server code needed support for, and not be generalised.

    Does that give any perspective to you?

  3. #3
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 11
    Location
    South Africa
    Posts
    865

    Re: Reusable socket server library or built into code ?

    Yes, I was wondering whether I should generalize my networking code into a dll so that all the applications I make can use it, but generalizing it will intern make the code of my applications more complicated and not all applications require a big networking library. I'm thinking of doing what you said I was just wondering what the other people do with their projects that have to act as a server.

    I will leave this open if anyone else has some input. For the time being i'm going to scratch the idea of a networking dll.

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  4. #4
    Fanatic Member SJWhiteley's Avatar
    Join Date
    Feb 09
    Location
    South of the Mason-Dixon Line
    Posts
    885

    Re: Reusable socket server library or built into code ?

    What is a 'big network library'? A 'server' and a 'client' is all any network library fundamentally needs. You just build on those blocks. Once you build a library (e.g. a TCP server and client) you can reuse it over and over for all your TCP needs. I have my own which I use for communication with: PLCs, Computer to computer, inter-process, intra-process, internet, intranet; anywhere a TCP client or server is needed. The protocol over TCP is built in another library, and the application references that library.

    While building a reliable TCP server is not trivial, it is not a huge undertaking. I believe JMC has a link in the code bank, as a baseline or as-is. Having a reusable library is very useful. As far as the protocols (e.g. IRC) go, I personally like it separate from the underlying 'transport' mechanism.
    "Ok, my response to that is pending a Google search" - Bucky Katt.

  5. #5
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 11
    Location
    South Africa
    Posts
    865

    Re: Reusable socket server library or built into code ?

    What I mean with a big network library is a dll that I can reference in any project that is a tcp server. What I mean by that is it can listen on multiple ports and can have many connections to it. It will handle sending and recieveing and communicate the data back via events or another method. This library will also need to be multithreaded quite a bit. My original question was whether to build this functionality into my application itself, or turn it into a library so that my other applications can use it as well. I decided to build it into my application because It makes things too complicated to generalize it.

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •