Menu

#4 PORT command fix for Big Endian native

open
nobody
None
5
2005-12-16
2005-12-16
Adam Payne
No

around line 119 of FtpDataSocket.java:

short port = (short) dataserver.getLocalPort();
return
((InetAddress.getLocalHost()).getHostAddress()).replace(
'.', ',') + "," + port / 256 + "," + port % 256;

does not work when run on Big Endian native systems
such as PowerPC, because the type cast from int to
short creates a negative signed short. To properly get
the integer values of the two bytes of the port number:

int port = dataserver.getLocalPort();
return
((InetAddress.getLocalHost()).getHostAddress()).replace(
'.', ',') + "," + ((port & 65280) >> 8) + "," +
(port & 255);

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.