Solved

FTP with winsock

Posted on 2000-02-14
12
648 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
  • 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This video teaches viewers about errors in exception handling.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

832 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