yo3ggx Active Member Licensed User Longtime User Oct 10, 2021 #1 I have a tcp connection established to a remote server. How can I find the tcp port used by the local socket? I want to use it for an UDP connection too. Thank you.
I have a tcp connection established to a remote server. How can I find the tcp port used by the local socket? I want to use it for an UDP connection too. Thank you.
Erel B4X founder Staff member Licensed User Longtime User Oct 11, 2021 #2 There is no relation between the tcp port and the udp port. I don't see how it will help, but you can get it with: B4X: Dim port As Int = Socket1.As(JavaObject).GetFieldJO("socket").RunMethod("getLocalPort", Null) Upvote 0
There is no relation between the tcp port and the udp port. I don't see how it will help, but you can get it with: B4X: Dim port As Int = Socket1.As(JavaObject).GetFieldJO("socket").RunMethod("getLocalPort", Null)
yo3ggx Active Member Licensed User Longtime User Oct 11, 2021 #3 Thank you Erel. I need to be the same port used for both TCP and UDP because of a specific firewall. Upvote 0