MCPcopy Index your code
hub / github.com/python/cpython / makeport

Method makeport

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 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)"""

Callers 3

ntransfercmdMethod · 0.95
test_makeportMethod · 0.80
test_makeportMethod · 0.80

Calls 5

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

Tested by 2

test_makeportMethod · 0.64
test_makeportMethod · 0.64