Access internal network locations from Internet

  • Thread starter Thread starter scorpion53061
  • Start date Start date
S

scorpion53061

I have been asked to come up with a way to make a instant message program
that will allow our outside customers by clicking on a name in a drop down
menu can IM who they want.

THe application I have works after telling my router to forward all
communications from Port 5000 to a local IP address that contains the
"Socket Server" program.

mobjClient = New TcpClient("zz.zzz.zz.zz", 5000)
mobjClient.GetStream()

DisplayText("Connected" & vbCrLf)

mobjClient.GetStream.BeginRead(marData, 0, 1024, AddressOf DoRead,
Nothing)
Send(ipadd & " online")

THe only problem is that all users would get this message that are running
the client........not just the individual being requested.

Is there a way in this code sample to tell it to divert to a local IP(or
machine name) running the client within this network?
 
Scorpion,
I dont think so, but you can look voor NAT (Network Adress Translator).

I hope it puts you a very little bit on the route.
Cor
 
Thanks Cor.......

I will try looking under vb.net and nat in google.

This topic does not have a lot of information that I can find. It has been
frustrating. It must be able to be done though because MSN Messenger does it
quite nicely.
 
Scorpion,
I dont think so, but you can look voor NAT (Network Adress Translator).

I hope it puts you a very little bit on the route.
Cor

NAT won't do you any good if the request is coming from the WAN side. NAT
can only redirect the data properly if the request originated from the
LAN side.

However, here are some suggestions:

-Each user has their own port. All requests coming into that port would
be redirected to a particular LAN user.

-Pass more data to the LAN side (i.e. Username). Have a proxy application
on the LAN server parse and forward the information to the proper client.

BTW, regarding the original posts, I find it funny that your router would
forward a packet from the WAN side with no particular matching NAT entry
to all clients... this is kind of dangerous when you think about it...
 
Lucas and all,

Thank you for response.

In the code attached can you tell me how I would:

"LAN server parse and forward the information to the proper client"

This is the server code that the traffic is coming to that is
sending/receiving messages.

Your server code sits on a server that has access to the WAN and LAN
right? Your server uses Port 5000? Port Map Port 5000 in your router to
the machine hosting server code - all incoming requests to port 5000 will
only be sent to the machine with the server.

When an IM user logs in, your server will need to track which users are
online, and associate their internal IP with their username (or some
other unique form of identification).

On your website, you have a list of all users logged in right? Thus, when
an external user submits your form with the appropriate user they want to
contact, your server would do a look up and match the username to the IM
user's internal IP. Once you have the internal IP, it would be very easy
to send the message directly to the client.

So basically your architecture would look like this:

WAN LAN
Web user <-> Web Page <-> || <-> Server <-> IM

|| Is your router/firewall.

See how the Server acts as a proxy, relaying requests between WAN and
LAN?

So in your code, you'll need to beef up server code so you can redirect
the message to a particular user behind the firewall.

BTW, which IM software are you using?

To sum it up, the key is for your server code to know the internal IP
address of the IM client, so that the message can be directed to a
particular IM user.
 
Your server code sits on a server that has access to the WAN and LAN
right? Your server uses Port 5000? Port Map Port 5000 in your router to
the machine hosting server code - all incoming requests to port 5000 will
only be sent to the machine with the server.


That is exactly what I have currently.
When an IM user logs in, your server will need to track which users are
online, and associate their internal IP with their username (or some
other unique form of identification).

They currently log in to our customer software which validates through a SQL
Server table called LOGINS. They can then select n in a drop down menu
select say "Plumbing Pricing Questions". Then the client software opens and
establishes a connection to the socket server. From there is where I dont
know how to direct the request to teh local IP at that point.
On your website, you have a list of all users logged in right? Thus, when
an external user submits your form with the appropriate user they want to
contact, your server would do a look up and match the username to the IM
user's internal IP. Once you have the internal IP, it would be very easy
to send the message directly to the client.

Okay so lets say I create another SQL table with these 2 fields for those
the customers are requesting to message with their local IP address so it
would be:

DEPARTMENT
Plumbing Pricing Questions

LOCALIP
155.155.1.30

I somehow have to get the socket server to acknolwedge the incoming request
as being for "Plumbing Pricing Questions" and then direct the message to
that IP.

So in your code, you'll need to beef up server code so you can redirect
the message to a particular user behind the firewall.

Yes exactly...........this is where I am stuck.
 
I somehow have to get the socket server to acknolwedge the incoming
request as being for "Plumbing Pricing Questions" and then direct the
message to that IP.

You might have to beef up your connect code. Upon connection, you make the
client to send a string/ID with which department they are handling. Save
this information somewhere, maybe as a variable in the client object?

I noticed you store a collection of clients in your code you posted
earlier. If you know which client connection is associated with which
department, you could loop through your collection of client objects, find
the proper client, and send the information to that one particular
client???
 
Do you or anyone else know a good book that specializes in vb.net and socket
programming? Of what I am trying to do here?
 
It is on the server end.

I am lost at trying to get a list of internal IP's online
and how to direct messages to them from customers.

I am not even sure how to transfer the variables involved
(custname, and user they are seeking) to transfer to the
server program and how to restrict the conversation to
strictly between those two.

If you can help with this I would be very greatful.
Email me off list if you are willing.
 
Back
Top