Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Web Server serving as a TCP/IP communication server as well

Web Server serving as a TCP/IP communication server as well

Scheduled Pinned Locked Moved ASP.NET
questioncsharpc++asp-netgame-dev
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stevo Z
    wrote on last edited by
    #1

    Hi Guys, I want to implement following architecture and want to check with you if it generally makes sense, what you think about it and whether I could do it in a better way. There is a gaming server which can provide information on the fly using a C++ plugin. I'd like to use this information, process it and display on web so people can look and see what's happening in the game without having the actual game. So I decided to open a TCP/IP connection between the gaming server and a web server (which will be sitting on a web hosting site, haven't decided which one yet). My worry is whether I'll be able to use the web server as a TCP/IP communication server, so the game plugin can connect to my web server listening for incomming connections on a background thread and receive the information. Facts:

    Gaming server running C++ game and a TCP/IP client sending data potentionally every second

    Web Server (ASP.NET + Silverlight 4) running a TCP/IP server on a background thread listening for game server(s - will be potentionally more) and waiting for data.

    I know it's a very trick question, but do you think that this architecture makes sense? Do you think I'll be able to connect to my webserver using TCP/IP from outside? Or would a different protocol by better? (sending data using http, but I'd like to avoid that as I think it would be slower and I would not be able to talk back to the gaming server if I needed). Regards, Stevo

    zilo

    D 1 Reply Last reply
    0
    • S Stevo Z

      Hi Guys, I want to implement following architecture and want to check with you if it generally makes sense, what you think about it and whether I could do it in a better way. There is a gaming server which can provide information on the fly using a C++ plugin. I'd like to use this information, process it and display on web so people can look and see what's happening in the game without having the actual game. So I decided to open a TCP/IP connection between the gaming server and a web server (which will be sitting on a web hosting site, haven't decided which one yet). My worry is whether I'll be able to use the web server as a TCP/IP communication server, so the game plugin can connect to my web server listening for incomming connections on a background thread and receive the information. Facts:

      Gaming server running C++ game and a TCP/IP client sending data potentionally every second

      Web Server (ASP.NET + Silverlight 4) running a TCP/IP server on a background thread listening for game server(s - will be potentionally more) and waiting for data.

      I know it's a very trick question, but do you think that this architecture makes sense? Do you think I'll be able to connect to my webserver using TCP/IP from outside? Or would a different protocol by better? (sending data using http, but I'd like to avoid that as I think it would be slower and I would not be able to talk back to the gaming server if I needed). Regards, Stevo

      zilo

      D Offline
      D Offline
      DeepToot
      wrote on last edited by
      #2

      You will have to first make sure that the hosting site you are using allows TCP/IP communications, most probably only allow HTTP outbound only. My suggestion is (and not the only suggestion), if this is possible with the plugin you mentioned, have the plugin write to a database all the results you are wanting to see. Create a web service that will be used by the web page to query the database for the updated data. You can have the plugin update the database as much as you want and query the database as much as you want. So the performance will be there like any other web site. If you can connect via TCP/IP to the host and from the game server, you could use Remoting and create an http/tcp channel to do this as well. Hope this helps a little. There are more ways to do this, but only have time to post this suggestion.

      S 1 Reply Last reply
      0
      • D DeepToot

        You will have to first make sure that the hosting site you are using allows TCP/IP communications, most probably only allow HTTP outbound only. My suggestion is (and not the only suggestion), if this is possible with the plugin you mentioned, have the plugin write to a database all the results you are wanting to see. Create a web service that will be used by the web page to query the database for the updated data. You can have the plugin update the database as much as you want and query the database as much as you want. So the performance will be there like any other web site. If you can connect via TCP/IP to the host and from the game server, you could use Remoting and create an http/tcp channel to do this as well. Hope this helps a little. There are more ways to do this, but only have time to post this suggestion.

        S Offline
        S Offline
        Stevo Z
        wrote on last edited by
        #3

        That's very true. I've checked with a couple of hosting sites and they are not really keen to do it this way. Also, because of my poor C++ skills (hey I'm working with Silverlight 4, that's a different world...) I want to keep the C++ part as simple as possible. After a lot of swearing and effort I've managed to use CURL, pthreads and JSON to send the data from the plugin to the webserver and there I'm handling it with a custom handler. This way it's also simple for anyone to deploy the plugin - that's one of the important things as well - KISS :) . I've never done database stuff in C++ and I'm scared even to google for that :laugh: . I'd like to keep all the business logics on the webserver. Thanks for your imput though, I still don't know how is it going to turn out, it's an interesting project. :thumbsup:

        zilo

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups