make utils.select posix-compat

This commit is contained in:
Jan Pochyla 2016-04-29 15:05:08 +02:00 committed by Pavol Rusnak
parent 1664a4fc29
commit 38aa463060
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
1 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,6 @@
#include <arpa/inet.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <assert.h>
#define TREZOR_PORT 21324
@ -10,9 +11,11 @@ static socklen_t slen = 0;
void msg_init(void)
{
s = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP);
s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
assert(s != -1);
fcntl(s, F_SETFL, O_NONBLOCK);
si_me.sin_family = AF_INET;
si_me.sin_port = htons(TREZOR_PORT);
si_me.sin_addr.s_addr = htonl(INADDR_ANY);