|
-
Jan 11th, 2010, 08:49 PM
#1
Thread Starter
Junior Member
[RESOLVED] A question for experienced guys.
OK. I've been searching this in internet for weeks, reading books, asking friends - but no sucsess. I was looking for an example or clue how to program on wide area network. All I found were some useless local network apps, I mean who would even use them? I also found ftp, but ftp is too slow and inconvinient. So many programmers are here, so please, can you tell me if it's even possible to program on wide area network, even between countries, in vb.net??? Thanks.
Last edited by Shadow-GK; Jan 11th, 2010 at 08:52 PM.
-
Jan 11th, 2010, 09:47 PM
#2
Re: A question for experienced guys.
depends on what you're trying to accomplish. We use a combination of remoting, web services, and WCF with compression. All over an http vpn connection.
-tg
-
Jan 12th, 2010, 11:47 PM
#3
Thread Starter
Junior Member
Re: A question for experienced guys.
Well, basically my primary goals were to transfer a file directly to my friends computer, without using ftp server as a connector(because then I would just use an upload server like megaupload.com) and just to make it awesome I didn't want to use any software, i just wanted to write it myself. So transfering a file directly is what i wanted to do, doesn't matter if its a http or any other port. Preferrably not a commonly used one not to interact with another apps. :/
-
Jan 13th, 2010, 02:18 AM
#4
Lively Member
Re: A question for experienced guys.
Yes, You Can Do It Using MSWINSCK Control. You Will Just Need Your IP Address And Friend IP Address And Different PORT (Other Than HTTP[8080], FTP). And File Transfer Alogrithm.
-
Jan 13th, 2010, 11:48 AM
#5
Hyperactive Member
Re: A question for experienced guys.
Programming on a WAN is no different than a LAN. It's still network communication using IP addresses and ports. I can make a simple chat program and either connect to 192.168.1.100 or 24.65.408.xxx doesn't matter.
-
Jan 13th, 2010, 04:01 PM
#6
Thread Starter
Junior Member
Re: A question for experienced guys.
Wow really? I tried to turn a lan chat app into wan by changing the ip from 192.168.*.* to my other computers remote ip, but the client retuned an error saying something like "The server didn't respond properly or the connection was lost". So if you guys saw something like that can you just give me an example of it or a link to the post? That would be great. Thanks!
-
Jan 13th, 2010, 04:10 PM
#7
Hyperactive Member
Re: A question for experienced guys.
Well here's the problem, even though communication is the same, a WAN introduces a lot more devices that the data must pass through. Your main obstacles being local and remote routers/firewalls. You have to make sure nothing locally (on your end) is blocking the outbound traffic and also that nothing on the remote end is blocking the incoming traffic. and vice versa.
-
Jan 17th, 2010, 11:42 AM
#8
Junior Member
Re: A question for experienced guys.
The difference between sending data over a LAN and a WAN are large. For instance, you can just call a local LAN IP address, no problem. But when you're talking about a WAN, you have to consider things like NAT (Network Address Translation), in particular PAT (Port ...). What that does is convert local inside IP addresses to global inside IP address.
-
Jan 17th, 2010, 05:05 PM
#9
Lively Member
Re: A question for experienced guys.
Simple Here. We Are Saying
We Cant Build Chat Program (WINSOCK) For WANS?
OR
We Cant Build Web Chat Program (OFCOURSE WINSOCK) For Internet?
-
Jan 17th, 2010, 10:14 PM
#10
Junior Member
Re: A question for experienced guys.
There are many router-explicit blocks, for security reasons rightfully so. For instance, an Access Control List may only allow the use of an HTTP port, so that no harmful or large files can be transmitted.
-
Jan 17th, 2010, 11:01 PM
#11
Re: A question for experienced guys.
Your main issue is probably NAT traversal, as already mentioned. The simple workaround is to configure the NAT router at the "server" end to place the server PC in the DMZ. A less drastic measure is to use port mapping (sometimes called port forwarding) to tell the NAT router to forward connection requests it gets on port X to port Y of a given PC behind the router (X and Y can be equal but don't have to be).
The PC's software firewall will have to be configured to permit such inbound connections as well.
In more complex networks you may not have access to the routers and firewalls, making it a more difficult proposition.
-
Feb 6th, 2010, 08:51 PM
#12
Thread Starter
Junior Member
Re: A question for experienced guys.
Looking at your posts I made this summary of goals that should be accomplished to trasfer a file to WAN in the same way it is done to transfer to LAN( gosh, who thought it would be so complicated)
That's what modifications we need to do to a LAN client and server:
___|- Send bytes over WAN network.
______|- Configure LISTENER side firewall
______|- Configure LISTENER side router
______|- Configure other LISTENER settings (NAT,PAT, etc, etc)
______|- Preferably do the same steps with the CLIENT side
I chose to modify this UPD LAN client/server into WAN (but if you can do it with TCP/IP its fine)
CLIENT:
vb Code:
Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Imports System.IO
Public Class Form1
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
Dim udpClient As New UdpClient()
udpClient.EnableBroadcast = True
udpClient.Connect(t1.Text, 80)
Dim sendBytes As Byte()
sendBytes = Encoding.ASCII.GetBytes("Hello World?")
udpClient.Send(sendBytes, sendBytes.Length)
End Sub
End Class
SERVER:
vb Code:
Imports System.Net
Imports System.Text
Imports System.Threading
Imports System.Net.Sockets
Public Class Form1
Public Sub serverThread()
Dim udpClient As New UdpClient(80)
udpClient.EnableBroadcast = True
While True
Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
Dim receiveBytes As Byte()
receiveBytes = udpClient.Receive(RemoteIpEndPoint)
Dim returnData As String = _
Encoding.ASCII.GetString(receiveBytes)
MessageBox.Show( _
RemoteIpEndPoint.Address.ToString() + ":" + _
returnData.ToString())
End While
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim udpserver = New Thread(AddressOf serverThread)
udpserver.Start()
End Sub
End Class
Last edited by Shadow-GK; Feb 7th, 2010 at 12:45 PM.
-
Feb 7th, 2010, 12:42 PM
#13
Thread Starter
Junior Member
Re: A question for experienced guys.
OK!!here is the project in VB6. (original post here by dilettante) It basically maps the ports in the router and allows the traffic. Now, can anyone translate in into vb.net so others could use it? THANKS!
Last edited by Shadow-GK; Feb 28th, 2010 at 12:45 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|