Solved

FTP with winsock

Posted on 2000-02-14
12
658 Views
Last Modified: 2013-11-13
I'm attempting to use winsock VB 5.0 for file transferring over the net.
I'm able to make connect to a protected server, but I'm unable to transfer files. I need to send files to that server. I'm working behind router.
If anyone would know something about this.
0
Comment
Question by:ekinee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
12 Comments
 
LVL 14

Expert Comment

by:mcrider
ID: 2518033
Are you trying to use the winsock control or winsock API?

If you're using the API, check out the following microsoft KB article:

FILE: VBFTP.EXE: Implementing FTP Using WinInet API from VB
http://support.microsoft.com/support/kb/articles/Q175/1/79.ASP?LNG=ENG&SA=MSDN&FR=1 
 
Do you mean you're behind a firewall?


Cheers!
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2518046
Here is also an FTP server for VB... It may give you some ideas.

ftp://ftp.caas.com/pub/ftpserver.zip 
 

Cheers!
0
 

Author Comment

by:ekinee
ID: 2518260
I'm trying to use VB component.
my computer is in LAN wich is connected out through ISDN router.
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 14

Expert Comment

by:mcrider
ID: 2518701
Why not just use the Microsoft Internet Transfer Control (MSINET.OCX)... It has FTP built into it.  Just add it to your project and then check out the help pages... They're actually pretty good...


Cheers!
0
 
LVL 2

Expert Comment

by:telebasics
ID: 2518982
Can you transfer files to an unprotected server?

Cause to transfer files you will need the Port command to state to wich port the server should connect at you client machine (other than the port you are sendeing the commands with), after that the server will connect to your machine on that port (after you give the STOR command that is) as soon as you accept the connection you can send the contents of the file and when your done close the connection stating an EOF by doing that.

Therefor if your behind a firewall / router wich blocs all ports, you will have to open the port you are going to use on the firewall.
0
 

Author Comment

by:ekinee
ID: 2522360
I have tried Microsoft Internet Transfer Control and it makes path letters and filename in uppercase so, meaning menu.html will be MENU.HTML. This doesn't work for my purposes.
0
 

Author Comment

by:ekinee
ID: 2522664
To telebasics.

I have studied RFC959, and know PORT command format. But I do not know how to get this TCP port address.
If you could enlighten me how to form it.
0
 
LVL 2

Expert Comment

by:telebasics
ID: 2522754
the PORT command goes like this
PORT 10,0,0,1,3,4
 the first 4 pairs are the IP number of your machine (winsock.localIp)
The second to pairs are a pain in the but. they are one of two 8bit.
3 = 00000011
4 = 00000100
they form
0000001100000100 = 772

so if you want to use port 1025
you will need

0000010000000001 = 1025
split up the long ip string
00000100 = 4
and
00000001 = 1

getting a port string of
10,0,0,1,4,1

If someone has a nice routine doing this automaticly i want it.

The port on your local machine must be 1024 up

You will need to use a free PORT in this action, i haven't figured out how to get a free port automaticly from winsock and rebuild it to ,4,1 to be used in the PORT command. But being a little less flexible i use the 1025 PORT (,4,1) and it works most of the time.

after the STOR or RETR commands are given the server will connect on this port (so you will have to listen and accept the connection)
0
 

Author Comment

by:ekinee
ID: 2526021
I'm working behind a firewall, and I don't have solid IP address,but it is on our network provider, so you sead I had to open a Port myself.
How do I do that.
0
 
LVL 2

Accepted Solution

by:
telebasics earned 100 total points
ID: 2526172
I used 2 winsocks one wich connects to the server on port 21 and one wich lsiten's on the port stated with PORT command to server.
Your Ip adress is in the winsock.localip
replace the . for , and add the port ,4,1 and your port command is ready. when you state a stor or retr command the server will trie to connect to that port wich is listened to by the second winsock, you accept this connection and startg sending the file or start retrieving the file.
0
 

Author Comment

by:ekinee
ID: 2530579
I ended up doing it with WinAPI, but this did however clarify.
0
 
LVL 2

Expert Comment

by:telebasics
ID: 2530692
Good luck
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

734 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