Jump to content


Yet again-> Socket Programming .Net


6 replies to this topic

#1 purvasraut

    New Member

  • Members
  • Pip
  • 4 posts

Posted 17 April 2011 - 03:49 PM

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

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 5310 posts
  • LocationSanta Clara, CA

Posted 17 April 2011 - 04:22 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 purvasraut

    New Member

  • Members
  • Pip
  • 4 posts

Posted 17 April 2011 - 05:14 PM

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

#4 Reedbeta

    DevMaster Staff

  • Administrators
  • 5310 posts
  • LocationSanta Clara, CA

Posted 17 April 2011 - 05:48 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#5 purvasraut

    New Member

  • Members
  • Pip
  • 4 posts

Posted 17 April 2011 - 06:08 PM

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

#6 TheNut

    Senior Member

  • Moderators
  • 1701 posts
  • LocationCyberspace

Posted 17 April 2011 - 06:38 PM

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.
http://www.nutty.ca - Being a nut has its advantages.

#7 purvasraut

    New Member

  • Members
  • Pip
  • 4 posts

Posted 18 April 2011 - 07:44 PM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users