Solved

IP confusion

Posted on 1998-08-14
5
160 Views
Last Modified: 2013-11-20

I am a little bit confused and I hope someone will kindly help me.
Please execuse me for the following simple questions cause  I am trying to write my first winsock program.


I have 2 PCs (WIN95)  connected to the Internet using ISP and modem. Here are the questions:

1. Is the IP address of each of them a local one and I cannot use it to send something directely to them from another machine on the Internet using WinSock?
2. Do they get a new IP address each time they connect to the Internet (Dial-up)?
3. Is there anyway that I can code a program that send a file or text from one of them to the other without using a server or broker?
4. What are the answers to the above 3 questions in case that these 2 clients are using NIC and behind a firewall or broxy?

Is there any example for client to client direct communications ?
0
Comment
Question by:kawa
  • 3
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
snoegler earned 100 total points
Comment Utility
Hello,

I hope i this information is useful to you ...
>>1. Is the IP address of each of them a local one and I cannot use it to send >>somethingdirectely to them from another machine on the Internet using WinSock?
Usually a PC which is connected via dial-up networking to the internet receives a dynamically
assigned IP adress. This adress stays the same during one session. But there are exceptions:
a) Your provider uses statically assigned IP adresses (which is usually quite expensive)
b) Your winsock.dll is replaced by the AOL winsock. I am not totally sure about that, but i know
     that AOL uses *not* the standard dial-up networking, they have something proprietary
     instead.
That means, this adress is internet-wide valid during the session. So it is possible to send
data from one machine to the other, the only problem is to know about the adresses.
Maybe you could solve this by using a known FTP server you have write access for.
Each machine could store their adresses after login for example in some file
'/mydir/<machine>.txt' on the server, so you could retrieve the other one's IP automatically by
reading these files.
>> 2. Do they get a new IP address each time they connect to the Internet (Dial-up)?
Yes, usually (look above)
>> 3. Is there anyway that I can code a program that send a file or text from one of them to
>> the other without using a server or broker?
If you have both IP adresses of both machines, yes. But to get the IP adresses of each other
programmatically, i think you'll need a server (look under 1)
>> 4. What are the answers to the above 3 questions in case that these 2 clients are using NIC
>> and behind a firewall or broxy?
This depends on the implementation of the firewall/proxy.
a) firewall/proxy standing at the provider, both computers connected by modem
   - usually this should be the same as if the firewall/proxy wasn't there. Exceptions are that
     if it is a firewall, you can use only 'known' ports. Your provider should be able to give you
     a list with possible ports - safe are in each case the IPPORT_FTP and IPPORT_HTTP
     ports.
   - the proxy could also treat the users 'behind' it as an own IP net.
     If this is the case you should contact your provider - this is implementation depending.
b) firewall/proxy is the computer with the modem, computers connected via LAN.
   - In this case you could exchange data on a LAN basis without problems, but the firewall
     usually won't assign IP adresses to the machines behind it. If the LAN is using TCP/IP,
     this problem solves itself - each machine has (in the LAN) a well defined IP adress, so
     the way for exchanging data using winsock is totally transparent to your application.

>> Is there any example for client to client direct communications ?
Yes, on the Visual C++ CD are two examples:
- CHATSRVR, a chat server.
- CHATTER, a chat client.
CHATTER will ask you for the internet adress the 'CHATSRVR' app is running, this is the
only point which is a bit different to handle. Either you implement the method i mentioned
at the beginning of this message (storing both adresses somewhere in the net and fetching
it back) - or you add a message box to CHATSRVR which displays the CHATSRVR's
IP address before the program starts.

snoegler
0
 

Author Comment

by:kawa
Comment Utility
Thanks for the explaination.
I will accept your answer but I hope you can tell me your idea if I have one  client behind a company firewall and the other is using modem through ISP . can I make them direcely send files to each other  ?
0
 
LVL 6

Expert Comment

by:snoegler
Comment Utility
You need to know if the machines behind the firewall completely hidden to the internet.
If yes, that's bad luck.
If no you'll probably have to authentificate the incoming request, the protocol for that depends
on the type of firewall. You should be able to get a documentation on this (perhaps the
network administrator can explain this to you, or the docs on the firewall has information
about that - if not, you better ask some hackers, they'll know how to do it ;) )
I can't help you any further without information about the firewall. Perhaps someone other can,
but i think it would be helpful to all who read this question if you'd get this information and
post it here.
Good luck =o)
0
 

Author Comment

by:kawa
Comment Utility
Thank you.
I was hoping to make a general solution that will work with _any_ firewall. It looks now more complicated that I thought. I will check what the hackers do and if I get something I will share it with all the peoples here. I also hope that some more experts can post additional information on that subject. Thanks again

0
 
LVL 6

Expert Comment

by:snoegler
Comment Utility
If you want other experts to post additional information, you should not have accepted this
answer. Now anyone who tries to read it gets some points deducted from the account.
Thanks, though :)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now