TCP Socket Connection Server Side Type
I'm working on a small flash project for a web site. I've coded my tcp-server on a windows service. Is it possible to put the tcp-server on a web service ? Or should I accept the tcp-connections while the web page is loaded?
Any suggestions? Really I do not know the way to put the server. [With windows service it works, but I have to pay to a dedicated server monthly over 50£,开发者_StackOverflow if it is possible with web service i will need only IIS]
Thanks!
I've used for server C#
You should look into using WCF, which can be hosted within ASP.NET. But beware that if you're hosting this on a managed hosting platform, they're likely going to be blocking all ports beyond 80 and 443. So if your socket server is dedicated to just sockets, you might be able to use port 80, but then again, their infrastructure may not play nicely with that either.
Update:
When I said "managed hosting platform" I was mostly referring to virtual hosts. Those are typically very restricted in what they're allowed to do, so they'd most likely be blocked from listening on a TCP port. And the OS would probably block listening on port 80 also, since the web server (i.e. IIS) will be using that port.
With WCF, I believe you can set up bindings that basically implement comet functionality so you can do socket-like communication over HTTP, but this approach does not scale well (though it might be acceptable if you are going to have very lite usage).
Unfortunately, I don't know of any virtual hosting solutions that let you host a socket server. You might have to go with a dedicated host. Hopefully I'm wrong and there's something out there for your needs.
精彩评论