473,473 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

FTP Port

I am trying to write a simple FTP client, but I am having
trouble with the PORT Command. Does anyone know how to
Get an IP Address and port number to establish a data port
for the server to connect to.
Any info would be appreciated.
Jul 19 '05 #1
5 4338
http://www.w3.org/Protocols/rfc959/4_FileTransfer.html

"Keith" <ke****@inozsoftware.com> escribió en el mensaje
news:04****************************@phx.gbl...
I am trying to write a simple FTP client, but I am having
trouble with the PORT Command. Does anyone know how to
Get an IP Address and port number to establish a data port
for the server to connect to.
Any info would be appreciated.

Jul 19 '05 #2
Thanks for the FTP Command info, but I still do not know
how to obtain the IP Address and port info that follows
the PORT command. If I use a FTP Client like SmartFtp, it
send the PORT Command like this "PORT 192,168,0,2,4,127".
How do you get this IP address using the .Net framework?
-----Original Message-----
http://www.w3.org/Protocols/rfc959/4_FileTransfer.html

"Keith" <ke****@inozsoftware.com> escribió en el mensaje
news:04****************************@phx.gbl...
I am trying to write a simple FTP client, but I am having trouble with the PORT Command. Does anyone know how to
Get an IP Address and port number to establish a data port for the server to connect to.
Any info would be appreciated.

.

Jul 19 '05 #3
using System;
using System.Net;
using System.Text.RegularExpressions;

string porttext = "PORT 192,168,0,2,4,127";
MatchCollection matches = Regex.Matches (porttext, "\d+");
if (matches.Count < 4)
throw new Exception ("not valid");
IPAddress address = IPAddress.Parse (
matches[0] + "." +
matches[1] + "." +
matches[2] + "." +
matches[3]);

"Keith" <ke****@inozsoftware.com> escribió en el mensaje
news:06****************************@phx.gbl...
Thanks for the FTP Command info, but I still do not know
how to obtain the IP Address and port info that follows
the PORT command. If I use a FTP Client like SmartFtp, it
send the PORT Command like this "PORT 192,168,0,2,4,127".
How do you get this IP address using the .Net framework?
-----Original Message-----
http://www.w3.org/Protocols/rfc959/4_FileTransfer.html

"Keith" <ke****@inozsoftware.com> escribió en el mensaje
news:04****************************@phx.gbl...
I am trying to write a simple FTP client, but I am having trouble with the PORT Command. Does anyone know how to
Get an IP Address and port number to establish a data port for the server to connect to.
Any info would be appreciated.

.

Jul 19 '05 #4
You can get your IP address with the Socket class..

Socket.LocalEndPoint

If you have a socket object, you can get the local address:
((IPEndPoint)socket.LocalEndPoint).Address

Hope this helps
JuanCri
"Keith" <ke****@inozsoftware.com> escribió en el mensaje
news:04****************************@phx.gbl...
Again thanks for the reply. But I think I am not
describing the problem correctly. I will now try again.
I understand what makes up the PORT command but my problem
is how do I get the IP address for example 192.168.0.2 for
a data port. I can do it with winsock but I do not know
how to retrieve this client IP address for the data port
with .net. Sorry for the confusion.
-----Original Message-----
using System;
using System.Net;
using System.Text.RegularExpressions;

string porttext = "PORT 192,168,0,2,4,127";
MatchCollection matches = Regex.Matches (porttext, "\d+");
if (matches.Count < 4)
throw new Exception ("not valid");
IPAddress address = IPAddress.Parse (
matches[0] + "." +
matches[1] + "." +
matches[2] + "." +
matches[3]);

"Keith" <ke****@inozsoftware.com> escribió en el mensaje
news:06****************************@phx.gbl...
Thanks for the FTP Command info, but I still do not know
how to obtain the IP Address and port info that follows
the PORT command. If I use a FTP Client like SmartFtp, it
send the PORT Command like this "PORT 192,168,0,2,4,127".
How do you get this IP address using the .Net framework?
-----Original Message-----
http://www.w3.org/Protocols/rfc959/4_FileTransfer.html

"Keith" <ke****@inozsoftware.com> escribió en el mensaje
news:04****************************@phx.gbl...
I am trying to write a simple FTP client, but I amhaving trouble with the PORT Command. Does anyone know how to
Get an IP Address and port number to establish a dataport for the server to connect to.
Any info would be appreciated.

.

.

Jul 19 '05 #5
I used a Socket to send the FTP Commands and the
localendpoint gives me an address of 127.0.0.1, which is
fine but when I send the PORT command I need a new IP
address. That is where my problem is. If i create a new
Socket it still has the same IP address 127.0.0.1. When I
use the commercial client SmartFTP it uses the same
address 127.0.0.1 for the FTP commands and 192.168.0.2 for
the port command. How with .net can I get this IP address?

-----Original Message-----
You can get your IP address with the Socket class..

Socket.LocalEndPoint

If you have a socket object, you can get the local address:((IPEndPoint)socket.LocalEndPoint).Address

Hope this helps
JuanCri
"Keith" <ke****@inozsoftware.com> escribió en el mensaje
news:04****************************@phx.gbl...
Again thanks for the reply. But I think I am not
describing the problem correctly. I will now try again.
I understand what makes up the PORT command but my problem
is how do I get the IP address for example 192.168.0.2 for
a data port. I can do it with winsock but I do not know
how to retrieve this client IP address for the data port
with .net. Sorry for the confusion.
-----Original Message-----
using System;
using System.Net;
using System.Text.RegularExpressions;

string porttext = "PORT 192,168,0,2,4,127";
MatchCollection matches = Regex.Matches (porttext, "\d+");if (matches.Count < 4)
throw new Exception ("not valid");
IPAddress address = IPAddress.Parse (
matches[0] + "." +
matches[1] + "." +
matches[2] + "." +
matches[3]);

"Keith" <ke****@inozsoftware.com> escribió en el mensaje
news:06****************************@phx.gbl...
Thanks for the FTP Command info, but I still do not know
how to obtain the IP Address and port info that follows
the PORT command. If I use a FTP Client like SmartFtp, itsend the PORT Command like this "PORT 192,168,0,2,4,127".
How do you get this IP address using the .Net framework?
-----Original Message-----
http://www.w3.org/Protocols/rfc959/4_FileTransfer.html

"Keith" <ke****@inozsoftware.com> escribió en el mensaje
news:04****************************@phx.gbl.. .
I am trying to write a simple FTP client, but I am

having
trouble with the PORT Command. Does anyone know how to Get an IP Address and port number to establish a data

port
for the server to connect to.
Any info would be appreciated.
.

.

.

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Alexander N. Spitzer | last post by:
If I have a machine with 3 virtual IP addresses (192.168.1.), how can I start 3 instances of the same RMI application (each started with different properties/configs), each listening on the port...
0
by: per.bergstrom | last post by:
To whom it may concern, The serial port server 'cnhd38' has been terminated (on who's initiative, I don't know). It affects the users of the (at least) following nodes: cnhd36, cnhd44, cnhd45,...
2
by: willie | last post by:
Hi, I'm writing a program which requires the use of three serial ports and one parallel port. My application has a scanning devices on each port, which I can access fine with pyserial. ...
5
by: Jason | last post by:
After a server accepts a client connection on a certain port, a new socket is created on the server on a system managed dynamic port to handle the connection. Please confirm this. If so, how...
6
by: kai | last post by:
Hi, I was tring to run an example (HelloWorld.aspx) from MSPrss book, I get this message: "ASP.NET Development Server faild to start listening port 1034. Error message: An attempt was made...
7
by: Sharon | last post by:
Hi all, I've implemented a TCP server using the Socket async methods. When connecting to the server from 3 instances of hyper terminal, i've noticed that each of the newly created server sockets,...
4
by: H J van Rooyen | last post by:
Hi All, I am writing a polling controller for an RS-485 line that has several addressable devices connected. It is a small access control system. All is well- the code runs for anything from...
25
by: bmearns | last post by:
Is it possible to specify which port to use as the outbound port on a connection? I have the IP address and port number for the computer I'm trying to connect to (not listening for), but it's...
13
by: Rob | last post by:
Hi all, I am fairly new to python, but not programming and embedded. I am having an issue which I believe is related to the hardware, triggered by the software read I am doing in pySerial. I...
5
by: Maciej Sondej | last post by:
Hi, I have problem. I want to react on event which come from IO.Port(RS232). I have a class that works on console application class Program { static void Main(string args) {
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.