1
votes

I have a chat server that i create for my window phone app. Right now it working on my local computer, how do i make it online so everyone can connect to it.

Chat server: TcpListener chatServer = new TcpListener(4296);

Chat client: TcpClient client = new TcpClient("127.0.0.1", 4296);

How do i forward the port so i can host it online!

3

3 Answers

2
votes

In order for the world to see it you need to host it somewhere with a public IP address. You will then use this IP address in the client connection:

Chat client: TcpClient client = new TcpClient("xxx.xxx.xxx.xxx", 4296);

Depending on your platform you could use Google App Engine or Amazon Web Services to quickly deploy your application.

0
votes

That depends on your router/gateway. Check your router's documentation for more information how to forward ports.

0
votes

Basically If you want to deploy your app online you need your own Domain(you get your own IP to host), you can use Cloud Server to deploy(these is a good option, since you can deploy for free but storage is limited in free edition), Or else you can Host on your Routers IP Address.

If you are using first two option then these is a python script to start a listener service on given IP and port.

Here:

    import socket
    import sys
    HOST =''   # Symbolic name, meaning all available interfaces
    PORT = 8000 # Arbitrary non-privileged port
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    print 'Socket created'

    try:
        s.bind((HOST, PORT))
    except socket.error as msg:
        print 'Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
        sys.exit()
    print 'Socket bind complete'
    #Start listening on socket
    s.listen(10)
    print 'Socket now listening'
    #now keep talking with the client
    while 1:
        #wait to accept a connection - blocking call
        conn, addr = s.accept()
        print 'Connected with ' + addr[0] + ':' + str(addr[1])
    s.close()

These is just a sample, you can put all of Your code from Your PC to Cloud and edit the changes in IP.

And if you want your router to listen to the client then you have to go to the routers login page, for most of the router it is 192.168.51.1, go here and login as administrator, Then you should go to firewall configuration over there you will find an option of custom server, then click on it and then there configure the ip address, port,etc to host.

I prefer you to watch these full video to understand properly: Here Video In these video he is hosting for exploitation purpose you can host to do any other activity.

Thank You.