lsalzman / enet

ENet reliable UDP networking library
MIT License
2.71k stars 669 forks source link

Setting local source port for client? #200

Closed lolriven closed 2 years ago

lolriven commented 2 years ago

I don't know if it's currently possible to allow setting a source port for ENetHost After looking through the source code, in unix.c and win32.c there are two functions enet_socket_bind which check if(address!=NULL) assign port/address which is for the server portion but in case address==NULL the function automatically assigns port to 0.

I could write a pull request to allow clients set their source port if it's already not a feature. But I would like to be able to do this.

Edit: I realised I can assign the port by passing a non NULL ENetAddress struct.