The response text PASVdoes not have a standardized format ( EPSVhowever), so make sure you parse IP / Port correctly, as you can get one of many different formats used by real-world servers:
227 Entering Passive Mode (h1,h2,h3,h4,p1,p2).
227 Entering Passive Mode (h1,h2,h3,h4,p1,p2
227 Entering Passive Mode. h1,h2,h3,h4,p1,p2
227 =h1,h2,h3,h4,p1,p2
.
IP/Port , IP/Port, , IP/ /, , IP/Port.
, connection refused , , , ABOR, IP/ PASV, IP/.