Create a new socket and send a PORT command for it.
(self)
| 309 | return self.voidcmd(cmd) |
| 310 | |
| 311 | def makeport(self): |
| 312 | '''Create a new socket and send a PORT command for it.''' |
| 313 | sock = socket.create_server(("", 0), family=self.af, backlog=1) |
| 314 | port = sock.getsockname()[1] # Get proper port |
| 315 | host = self.sock.getsockname()[0] # Get proper host |
| 316 | if self.af == socket.AF_INET: |
| 317 | self.sendport(host, port) |
| 318 | else: |
| 319 | self.sendeprt(host, port) |
| 320 | if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT: |
| 321 | sock.settimeout(self.timeout) |
| 322 | return sock |
| 323 | |
| 324 | def makepasv(self): |
| 325 | """Internal: Does the PASV or EPSV handshake -> (address, port)""" |