I built a working client-server UDP connection for a multiplayer game using FSockets. I am now looking to implement DTLS with my UDP connections to encrypt the traffic between the server and client. I’m using OpenSSL libraries to implement the DTLS and I am encountering an issue with accessing the file descriptor of the platform specific sockets created in FSockets.
Here is an example of a piece of required OpenSSL code that uses a socket file descriptor:
BIO *bio = BIO_new_dgram(fd, BIO_NOCLOSE); //'fd' is the unique int representation (file descriptor) of the socket instance
I looked at the documentation and I do not see any FSocket or FUdpSocketBuilder functions/parameters that will return the FSockets File Descriptor, which I find odd for something I would considered rather basic. I looked at the UE4 engine code and it looks like I could build a GetSocketFD() function, but I would like to first see if anyone from the UE4 community knows of an existing or more optimal way to access the FD of a FSocket, or perhaps another way to implement DTLS without need of a socket’s FD.
I appreciate any assistance.
Also, a loosely related question regarding DTLS (but unrelated to UE4): Without DTLS I only needed one socket on the client and server that handles both listening and sending, but with DTLS it looks like both the server and client need 2 sockets, one for sending and one for storing the BIO_ADDR returned from DTLSv1_listen() for litening. Is this correct?