Blog posts for year 2005

News and other things I find interesting


RSS Feed


Sep
15
2005

Signup page

Last modified: Friday, April 22, 2011

Added a page to sign up for an account at brianbondy.com. I plan to offer several services which will be announced over time, but they will need to store information, and therefore you wll need to create an account. You can create an account here

Tags:

Add a new comment





Aug
30
2005

What's my IP?

Last modified: Friday, April 22, 2011

Added a page to the Other section that allows you to get your external IP address. You can access that page here.

Tags:

Add a new comment





Aug
29
2005

Archived old front page

Last modified: Friday, April 22, 2011

I archived the old front page. You can access that page here

Tags:

Add a new comment





Aug
1
2005

FTP protocol overview

Last modified: Friday, April 22, 2011

The official FTP standard is defined in RFC 959 [Postel and Reynolds 1985]. This article is in no way complete nor should it be used as an implementation guide alone.

FTP uses two TCP connections to transfer files:*

  1. The control connection

The control connection is made by the server listening to the default port for FTP which is 21. This port can differ, but the default is 21. The FTP server waits for a connection from the FTP client. The client does an active open from any port to port 21. The control connection once established, remains open for the duration of the communication between client and server. The control connection is used to specify what to do.

  1. The data connection

Once the control connection is used to specify that it would like to transfer a file, a data connection is established to actually transfer the file. The data connection is used for sending files, receiving files, and getting a list of files in the current directory.

FTP requests:

All FTP requests are 3 or 4 digit ASCII commands. Each command can have 0, 1, or more optional arguments. The most popular FTP commands are as follows:

  • ABOR - abort a file transfer
  • ACCT - send account information
  • APPE - append to a remote file
  • CDUP - CWD to the parent of the current directory
  • CWD - change working directory
  • HELP - return help on using the server
  • DELE - delete a remote file
  • LIST - list remote files
  • MDTM - return the modification time of a file
  • MKD - make a remote directory
  • MODE - set transfer mode
  • NLST - name list of remote directory
  • NOOP - do nothing
  • PASS - send password
  • PASV - enter passive mode
  • PORT - open a data port
  • PWD - print working directory
  • QUIT - terminate the connection
  • RETR - retrieve a remote file
  • REIN - reinitialize the connection
  • RMD - remove a remote directory
  • RNFR - rename from
  • RNTO - rename to
  • STAT - return server status
  • SITE - site-specific commands -SIZE - return the size of a file
  • STOR - store a file on the remote host
  • STOU - store a file uniquely
  • STRU - set file transfer structure
  • SYST - return system type
  • TYPE - set transfer type -USER - send username

FTP replies:

All FTP replies start with 3 digit status code in ASCII. An optional message can follow this 3 digit status code.

The first (left most) digit in the error code has special meaning.

  • 1xx: Used for positive preliminary replies.
  • 2xx: Used for positive completion replies.
  • 3xx: Used for positive intermediate replies. Which means everything was OK, but another command is expected.
  • 4xx: Transient negative completion reply.
  • 5xx: Permanent negative completion reply.

The second (middle) digit in the error codes also have special meaning.

  • x0x: Syntax error
  • x1x: Information
  • x2x: Connection related
  • x3x: Authentication related
  • x4x: Unspecified
  • x5x: Filesystem status

The third (right most) digit in the error code, is just used to be more specific.

Most FTP replies are 1 line replies, and can be read up to the first CR LF. However, some may be multi-line replies and you should therefore check to see if the 4th digit is a hyphen. If the 4th digit is a hypen, then you should keep reading lines until the 4th digit is not a hypen. All lines in a multiline reply will start with the same 3 digit status code. The final line in a multi line reply will not have a hyphen.

Using telnet to communicate with FTP:

As with many other ASCII protocols, you can communicate with an FTP server via telnet alone. To do this in windows, simply go to start menu | Run | command.com In the prompt type:

> telnet myservername.com 21
220 Microsoft FTP service

> USER brian
331 Password required for user brian

> PASS mypassword
230 User brian logged in.

> SYST
215 Windows_NT

You won't be able to easily test your data connection this way, but you can test out many of the FTP commands and see the replies that they give.

Debugging FTP:

As with every other protocol, when implementing or learning FTP, it is a good idea to use ethereal. You can download Ethereal/Wireshark. If you are using ethereal 0.10.9 or above, you will not need to download winPCAP.

Add a new comment





Jun
11
2005

Windows 64Bit AMD and Intel processor rundown

Last modified: Friday, April 22, 2011

I just purchased a new 64-Bit AMD computer and installed Windows 64-Bit AMD for the first time.

Here’s a short rundown on what I found out during my first night of using it.

There are 2 main types of 64-bit processors, IA64 and x64, and they run different versions of windows 64-bit.
That means that every driver built for Windows 64-Bit needs to be compiled twice.

The IA64 processor was called the Itanium. It was a huge flop because of problems with the way they did the caching. It was replaced with the Itanium 2, which has a better design for cache. Itanium 2 does not mean dual processors, but instead it means the 2nd design of Itanium (version 2). It is referred to the Itanium 2 CPU. It is now referred to as IA64 only.

With x64 you can install both Windows 32 bit or Windows 64 bit. With IA64 you can only install the IA64 Windows. You can run 32-bit apps on all variants. For the 64-bit Windows versions you can run the applications through an emulator that works transparently called Windows 32 on Windows 64 (WOW64)

The same does not hold for 32-bit drivers though. WOW64 is only for user mode applications.

On 64-bit machines there are actually 2 different registries. A 32-bit registry and a 64-bit registry. They are treated as different registries by 32-bit and 64-bit applications but the 32-bit registry is just a subkey for the 64-bit registry. Windows will automatically route an application to the proper registry depending on if it’s 32-bit or 64-bit.

Because of WOW64, any application that was compiled before on a 32-bit machine, will still work in 64-bit Windows. This isn't because it supports it direclty, but because windows is using WOW64 to translate the 32-bit calls to 64-bit ones. If however a program depends on a driver, or if it integrates with the windows shell, then that program will no longer work. I believe IPC is also translated on the fly by WOW64.

Some other useful information.

These 2 directories are both for 64-bit applications/drivers only. Pretty great naming! :), but I'm sure it will save many headaches for inf file authors.

  • C:\Windows\System32\
  • C:\Program Files\

These 2 directories are for 32-bit apps and drivers only, they use 32-bit emulation

  • C:\Windows\SysWOW64\
  • C:\Program Files (x86)\

So developing for 64-bit machines can get a little tricky if you actually want it to run as a 64-bit program. If it's running as a 32-bit program, then your ints will still be 4 bytes, and everything else you hold true will also still hold.

Right now, when I want to make a 64-bit program, I use a makefile instead of using Visual Studio directly. You can use different NSIS .exes to generate the different installers. I suggest to build each project with 3 different versions of NSIS. Then if you want to, you can build a 32-bit installer wrapper that combines each of your installers.

Tags:

Add a new comment





Next page