473,395 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Can I socket server over the internet?

Im trying to maket a program for sending files and other stuf over the internet to my friend. My problem is I cant get it to work over the internet it only works when we are on the same network. Is there a way to send stuf over the internet insted of the network? Am I just mising something or is this imposible. This is what ive ben using for server:

TcpListener SServer = new TcpListener(8000);
TcpClient SClient = default(TcpClient);
SServer.Start();
SClient = SServer.AcceptTcpClient();
NetworkStream NetStream = SClient.GetStream();
..........
blablabla you get the point

And this is what ive ben using for the client:

TcpClient SClient = new TcpClient();
SClient.Connect("my ip address heer", 8000);
NetworkStream netStream = SClient.GetStream();
.............
Apr 28 '10 #1
6 7019
tlhintoq
3,525 Expert 2GB
Does your friend really have a unique fixed IP address for his computer?
Are you sending to the IP address of his router, which in turn is forwarding to the IP address of the PC?
Apr 28 '10 #2
@tlhintoq
We are both on a router if thats what you meen not the same one thow. And Im gusing your gonting to say I need to say I need to port forword or something like that but I tried that and it didnt work so Im guesing I screwed up.
Apr 28 '10 #3
tlhintoq
3,525 Expert 2GB
If your computer shows an IP address of: 192.168.0.150
And at your friend's house his IP of: 192.168.0.10
Those addresses are not visible to the rest of the world.
You know that, right?

If you are trying to create a TCP connection between two IP addresses, you have to have addresses that are unique in the entire internet and are visible to the world. Like a company web server. Dodge.com pays for a unique IP address, that is mapped to the human-friendly address of "dodge.com"

If you aren't paying for a unique IP address, then you don't have one. Your ISP issues your router whatever address is free at the time. Your router issues different addresses to the computers on your network.

Your router: 227.1.2.3.4
Your computer behind that router: 192.168.0.1
Another computer at your house: 192.168.0.2

Friend router: 123.8.6.7
Friend's computer: 192.168.0.1
Another computer: 192.168.0.1

Notice that both you and your friend can have computers with the same IP address, because they are behind the router which has a unique address.

But remember, that unique address at the router is on loan. Tomorrow it might be a different IP address.
Apr 28 '10 #4
@tlhintoq
So your saying it wont work unless I pay for a unique ip address?
Apr 28 '10 #5
tlhintoq
3,525 Expert 2GB
More or less, but what I'm really saying is you should probably research the technology you are trying to make use of, before investing a lot of time. If you want to develop applications that use IP communication you will save yourself a lot of time and heartache if you first understand how I.P. communication and addressing work.

Direct PC to PC communication over the internet is not trivial. Do you notice that instant messaging services require servers to act as an intermediary? Do you see many I.M. programs that would let you and your friend chat *without* going through their service - like Yahoo?

Right now, you are trying to develop a better television, without understanding how tv signals are broadcast.

There are so many file sharing systems out there. It might just be easier to create a LogMeIn or GoToMyPC account that you both share and accesses both of your computers. Then you can remotely see/use each other's computers and drag/drop files to each other.

Or just use Yahoo's file transfer option.
Or an iDisk account.
Or one of the many other file sharing sites.
Apr 28 '10 #6
Do I need an external static ip to host a web server or whatever?
Apr 29 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: anuradha.k.r | last post by:
hi, i am writing a socket program in python,both client side and server side.I've written the client side which is working perfectly fine(checked it against server program written in C).but as for...
1
by: Jonathan Woods | last post by:
Hi there, Please find file for illustrating infrastructure --> http://test.thipparath.com/GPRS/GPRS.jpg . Gateway receives packets from Trucks for processing Route/GPS position. When Truck and...
0
by: Jonathan Woods | last post by:
Hi there, Please find file for illustrating infrastructure --> http://test.thipparath.com/GPRS/GPRS.jpg . Gateway receives packets from Trucks for processing Route/GPS position. When Truck and...
1
by: batista | last post by:
Hi, My problem is that i have a client which was, uptil now, running inside a lan and using sokcet communication to connect to server which is also insdie the same lan.....(it was all working...
18
by: nephish | last post by:
lo there, i have a simple app that connects to a socket to get info from a server i looks like this serverhost = 'xxx.xxx.xxx.xxx' serverport = 9520 aeris_sockobj =...
5
by: zxo102 | last post by:
Hi, I am doing a small project using socket server and thread in python. This is first time for me to use socket and thread things. Here is my case. I have 20 socket clients. Each client send a...
4
by: SpreadTooThin | last post by:
client: import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("192.168.1.101", 8080)) print 'Connected' s.send('ABCD') buffer = s.recv(4) print buffer s.send('exit')
6
by: Sean | last post by:
Hi Everyone, My apologies for a somewhat dump question but I am really stuck. I have been working on this code for two days straight I am dont know what is wrong with it. when I run the code, All...
14
by: =?Utf-8?B?TWlrZVo=?= | last post by:
I have a sync socket application. The client is blocked with Socket.Receive(...) in a thread, another thread calls Socket.Close(). This unblock the blocked thread. But the socket server is still...
2
by: Jean-Paul Calderone | last post by:
On Mon, 12 May 2008 11:16:08 -0700 (PDT), petr.poupa@gmail.com wrote: I'm not sure if you need to write a server or a client. In your original code, you had a client which repeatedly established...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.