-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

John,

On 3/27/20 13:37, john.e.gr...@wellsfargo.com.INVALID wrote:
> A few random thoughts.
>
> First, this is really a MySQL driver thing, not a Tomcat thing.
> If you want to know why the driver does what it does, look at the
> driver source.  There is actually a Socket constructor that allows
> you to specify the local port.  I don't know why you would do that,
> but it's there.
>
> Second, it does appear to be possible for there to be multiple
> connections using the same source port as long as they go to
> different destinations.  Just read through the various links that
> people have provided.  Honestly it blows my mind that that's even
> possible, but that just shows how little I know about networking.
> How does the client OS route return packets correctly if they have
> the same source port?
Because the connection is defined by *both* endpoints in a TCP
connection. The client knows its own source port and the destination
port as well. Imagine two clients:

saddr sport daddr sport
::1   1400  x     3306
::1   1400  y     3306

All is well, there: the OS knows where to route data returning to
::1/1400/y/3306 distinctly from ::1/1400/x/3306. But if you have two
clients wanting to connect to the same destination (e.g. x:3306) then
they must have distinct source ports.

This is why most clients just use a random OS-assigned port.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl5+R5QACgkQHPApP6U8
pFjLsQ/+IdSoJIPFhNfLmQnxEKEQA13Arr9vUE4A+83uh2+tHmo0nwW9VBzWYRLT
hEciA++PSBKBDimaeNrjQBmNEmMfLnfWBZfc0TjDCAUEYvvBXslYyw9CySya3ISC
d79hCJj55oAiua+eJ7ZN/MyRgeldwF/3CsP6lwpoH/rR9KI8/oKqt4vV64a7BuTW
gSIlzKJ5BQCtGZIDZmf7PeL5d48GJnw0jdREFC8Bf8NYjS/uj8Cccy8XH7zPcraP
S8krhrqemH8e6UQE3XID+qyatkHXBo5AVC16soQ0+jwDp0oxCsV0Faxk+8KollKL
aWti+di9DOQkKSYHq0IgyE82sxxm8FL5vAKABpE/i9864PqwBBv9hIfk4Lyiqirx
zuI3kVEEixcgVnv6Wdrmj1oGdhIcV6kHD/cXlTgMRTcGLBqrMFFfj4YdgUUHwOId
ZaL1UMlH0sB9NiZtSwxnEFslHbqV6dYZjpWdBnTRjiYWbTsz5/ZLLMLxvg9V+cr2
fCc+/B+Co6q9DnUyipfDfcHfvXDoPFseMmCfXH8I/4DPD8dmAxzM9BoviL9GSnAG
T0AVfKtB/HeGeZ67jZ9iIqpNVhCjxRrb1XZmoa4RUTU5J8i1xxBqpnpcYtCQXoJm
q7UJpJAVOHg68NQgxh3YK7wemb9nSacWO587rhCNjkIoVKkMDCQ=
=K9in
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to