Server client application what is the best choice??

Discussion in 'Programming' started by francot514, Apr 4, 2014.

  1. francot514

    francot514 Well-Known Member

    I started this post, because i want to convert my sims ville roleplay into a server client application, and need some help about making choices for best implementation. I know there can be two choices what i barely know: tcp/ip listener and winsocks. Remeber im using Visual .net to development.
    What im trying to do is that be able to my program send data or packages between client and server or client-client, to allow the neighborhood be synchronized and all the changes made locally will send trough and loaded into other players...
    Any help or suggestion will apretiated.
  2. xezno

    xezno Member

    You mean like the updater I'm working on?
  3. Afr0

    Afr0 Well-Known Member

    If you're using C# or, they don't come with a native Winsock implementation, though it should be possible to load the Winsock libs using P/Invoke. However, it is not recommended. It's... kinda like making a fire in your kitchen when there's a stove available (OK, bad analogy, but whatever).
    Here's example code for asynchronous sockets in C#/, and here's an example with multithreaded TCPListener code in
    Though to be honest, if I wanted to make sure I could support hundreds or even thousands of clients in a client/server model, I would just use async sockets. Trying to make TCPListener work in a multithreaded environment is reinventing the wheel, and likely not to be as good.
    If you're just aiming for a peer to peer approach, TCPListener is fine.
  4. francot514

    francot514 Well-Known Member

    @ xexzno, what updater do you mean????

    @Afro thanks for recomendations, i think will be better using sockets, becaise as you say if i use tcplistener i had to reinvent the code and that will kind more work to me...
  5. xezno

    xezno Member

    The updater I am working on for OpenTSO... I kinda abandoned it though. I'm probably going to restart it, idk.
  6. francot514

    francot514 Well-Known Member

    Which is the best method to transfer files trough the winsocoket, any help???
  7. Fatbag

    Fatbag Member

    TCP makes reliably communicating streams of bytes over the internet as reliable and easy as doing it to your hard drive.

    What are you having trouble with? Are you having trouble finding example code?

Share This Page