Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using sockets

Status
Not open for further replies.

deratrius

Technical User
Feb 9, 2006
6
BE
Okay I am a bit new to python and not really a programmer so if my question seem stupid please bear with me :p

So I am trying to program a proxy ftp (for now anyway) but I have a problem. Here is how a connection is established in ftp (took it from the RFC):

Connection Establishment
120
220
220
421
Which means:
LOCAL COMMANDS BY USER ACTION INVOLVED

ftp (host) multics<CR> Connect to host S, port L,
establishing control connections.
<---- 220 Service ready <CRLF>.

So so far I've just made a code that creates a socket, binds it to ftp port (21) and waits for a connection. When a client tries to connect using ftp, the proxy just sends a 220 --> newSocket.send("220 This is the proxy. \r\n")
but this doesnt seem to trigger anything for the client, and when I sniff sent packets I only see the syn, syn ack, ack and not the 220 I sent, as if it was never sent.

Anyone has ideas/suggestions? I dont mind posting my whole code if needed. But I've been stuck with this for a little while and I would really love to start the real work...

Thanks in advance.
 
Stupid me, nvm I got it!

Just have:

newSocket, adresse = my_socket.accept()
newSocket.sendall("220 This is the proxy. \r\n")

Then the proxy will receive data (USER <username> \r\n ) and so on and the connection is established...

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top