Yet again-> Socket Programming .Net

D1662ae997a69c16b6ee91eef2cdc8fd
0
purvasraut 101 Apr 17, 2011 at 15:49

Hello,

I have a small Client-Server application. First the Server Binds to IPAddress.Any and a Port say 8221 and then Listens and waits.

Then the Client connects to the Server and they both communicate.

Communication is simple:
Server has 3 buttons. B1 to Bind and Listen and when the client connects B2 sends a ‘‘Hi’’ to the client and B3 sends a “Bye” :-)

When I run the client and server on 2 separate machines (ofcourse connected to the same wireless network) the communication takes place good.

Now I have bought a Domain Name say xyz.com with an own Dedicated IPAddress and is hosted on a NameServer (I am using ixwebhosting).
So I have a Server running on the above domain with is own IP. When I open my page www.xyz.com/server.aspx I see the 3 buttons. I click B1 and my server binds to the a IP (IPAddress.Any, Port:8221) and waits. Now I have this client but when I try to connect to the Server’s IP with port 8221 I get an SocketException ( A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Server’s IP:8221 )

I think I am missing something. I read the post about Port Forwarding as well but I am clear about how do I use it in my case.

Any help would be appreciated.

Thank you in advance.
Purva

6 Replies

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 168 Apr 17, 2011 at 16:22

Probably the host’s config does not have port 8221 open. Usually, all ports are kept blocked by a firewall except ones you specifically know you’re going to use. You need to get in touch with the hosting provider’s tech support. They may be able to open the port or show you how to do so.

D1662ae997a69c16b6ee91eef2cdc8fd
0
purvasraut 101 Apr 17, 2011 at 17:14

Hi,
Thank you for your prompt response.

Well I checked with the hosting provider’s tech support regarding the unblocking of the port but I got the following response :

” We cannot unblock the port because this application is your own and there is no any installation guide and official requirements of the server which we could provide to our administrators. We couldn’t unblock port for such application due to Shared Hosting Environment. “

Now, I have no idea as to how I can check whether my Client-Server communication works on the Internet or not!

Any suggestions? I need to do this.

Thanx in advance.
Purva

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 168 Apr 17, 2011 at 17:48

Are you running on the web hosting service? I presumed you were on a virtual private server. They’re not going to let you run anything but a web app on the web servers, so if you want to use the web hosting you’ll need to implement your communication over HTTP on port 80, instead of a custom protocol. If you want to do your own stuff with custom executables, protocols, etc. you’ll need a virtual private server.

D1662ae997a69c16b6ee91eef2cdc8fd
0
purvasraut 101 Apr 17, 2011 at 18:08

Hi,

Thanx again.

Yes I am hosting on a Web Hosting Service(WHS).

Now I have 2 questions:

Q1) If I choose to continue with WHS I should make my server socket.Bind() to IPAddress.Any, Port: 80 and my client to socket.Connect() to Server’s IP, Port: 80 to make my communication work?

Q2) If I opt for a VPS Hosting then do I have to make any other modifications other than requesting for opening the port 8221 ?

I am totally new in this. In fact this is my 1st application that I am developing with Sockets so please bear with me if I sound silly!

Thanx in advance.
Purva

6837d514b487de395be51432d9cdd078
0
TheNut 179 Apr 17, 2011 at 18:38

Are you developing with JSP or ASP.NET? Shared hosting is limited to web traffic only. You cannot host any servers because your host only provides you with a web server (such as IIS or Apache) and all you can do is transfer content over their web server. You can’t bind to port 80 because it’s already in use.

Unlike shared hosting, a VPS provides you with your own virtual system such as Linux or Windows and with better hardware. This allows you to do whatever you want. It’s like having a second computer, although its resources are shared with other servers on the box. This sounds like the package you want. I would also suggest you purchase one that comes with a dedicated IP.

D1662ae997a69c16b6ee91eef2cdc8fd
0
purvasraut 101 Apr 18, 2011 at 19:44

Hi,
Thanks a lot for your guidance.
Well, I am working with asp.net.
I will go for VPS now and try out.

If I get any problems further I will get back here… ;)

Thanx again.

Purva