P1sec / pysctp

SCTP stack for Python
http://www.p1sec.com
165 stars 67 forks source link

How to configure source port for client #38

Closed naseemr closed 2 years ago

naseemr commented 3 years ago

Hi, Can someone give me an example on how to configure source port? Thanks,

p1-bmu commented 3 years ago

bindx() is the call to bind the socket after you created it and before you connect it with connectx():

import sctp, socket
sk = sctp.sctpsocket_tcp(socket.AF_INET)
# bind it locally
sk.bindx([(myip1, myport1), ])
# connect it to the remote server
sk.connectx([(dstip1, dstport1), ])