MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / makeport

Method makeport

tools/python-3.11.9-amd64/Lib/ftplib.py:311–322  ·  view source on GitHub ↗

Create a new socket and send a PORT command for it.

(self)

Source from the content-addressed store, hash-verified

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 resp = self.sendport(host, port)
318 else:
319 resp = 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)"""

Callers 1

ntransfercmdMethod · 0.95

Calls 5

sendportMethod · 0.95
sendeprtMethod · 0.95
getsocknameMethod · 0.80
create_serverMethod · 0.45
settimeoutMethod · 0.45

Tested by

no test coverage detected