Results 1 to 13 of 13

Thread: [RESOLVED] A question for experienced guys.

  1. #1

    Thread Starter
    Junior Member Shadow-GK's Avatar
    Join Date
    Jul 2009
    Posts
    25

    Resolved [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.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Junior Member Shadow-GK's Avatar
    Join Date
    Jul 2009
    Posts
    25

    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. :/

  4. #4
    Lively Member SamCasper's Avatar
    Join Date
    Dec 2009
    Posts
    89

    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.

  5. #5
    Hyperactive Member danecook21's Avatar
    Join Date
    Feb 2008
    Location
    NC, USA
    Posts
    501

    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.

  6. #6

    Thread Starter
    Junior Member Shadow-GK's Avatar
    Join Date
    Jul 2009
    Posts
    25

    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!

  7. #7
    Hyperactive Member danecook21's Avatar
    Join Date
    Feb 2008
    Location
    NC, USA
    Posts
    501

    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.

  8. #8
    Junior Member
    Join Date
    Jan 2010
    Posts
    20

    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.

  9. #9
    Lively Member SamCasper's Avatar
    Join Date
    Dec 2009
    Posts
    89

    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?

  10. #10
    Junior Member
    Join Date
    Jan 2010
    Posts
    20

    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.

  11. #11
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    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.

  12. #12

    Thread Starter
    Junior Member Shadow-GK's Avatar
    Join Date
    Jul 2009
    Posts
    25

    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:
    1. Imports System.Net
    2. Imports System.Net.Sockets
    3. Imports System.Text
    4. Imports System.IO
    5.  
    6. Public Class Form1
    7.  
    8. Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
    9. Dim udpClient As New UdpClient()
    10. udpClient.EnableBroadcast = True
    11. udpClient.Connect(t1.Text, 80)
    12. Dim sendBytes As Byte()
    13. sendBytes = Encoding.ASCII.GetBytes("Hello World?")
    14. udpClient.Send(sendBytes, sendBytes.Length)
    15. End Sub
    16.  
    17. End Class

    SERVER:

    vb Code:
    1. Imports System.Net
    2. Imports System.Text
    3. Imports System.Threading
    4. Imports System.Net.Sockets
    5.  
    6. Public Class Form1
    7.     Public Sub serverThread()
    8.         Dim udpClient As New UdpClient(80)
    9.         udpClient.EnableBroadcast = True
    10.         While True
    11.             Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
    12.             Dim receiveBytes As Byte()
    13.             receiveBytes = udpClient.Receive(RemoteIpEndPoint)
    14.             Dim returnData As String = _
    15.             Encoding.ASCII.GetString(receiveBytes)
    16.             MessageBox.Show( _
    17.             RemoteIpEndPoint.Address.ToString() + ":" + _
    18.             returnData.ToString())
    19.         End While
    20.     End Sub
    21.  
    22.     Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    23.         Dim udpserver = New Thread(AddressOf serverThread)
    24.         udpserver.Start()
    25.     End Sub
    26. End Class
    Last edited by Shadow-GK; Feb 7th, 2010 at 12:45 PM.

  13. #13

    Thread Starter
    Junior Member Shadow-GK's Avatar
    Join Date
    Jul 2009
    Posts
    25

    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
  •  



Click Here to Expand Forum to Full Width