File tree 1 file changed +6
-3
lines changed
can/interfaces/udp_multicast
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
import errno
2
2
import logging
3
+ import platform
3
4
import select
4
5
import socket
5
6
import struct
6
7
import time
7
8
import warnings
8
- import platform
9
9
from typing import List , Optional , Tuple , Union
10
10
11
11
import can
22
22
ioctl_supported = False
23
23
pass
24
24
25
- # All ioctls aren't supported on MacOS.
25
+ # All ioctls aren't supported on MacOS.
26
26
is_macos = platform .system () == "Darwin"
27
27
28
28
log = logging .getLogger (__name__ )
@@ -277,7 +277,10 @@ def _create_socket(self, address_family: socket.AddressFamily) -> socket.socket:
277
277
278
278
# Allow multiple programs to access that address + port
279
279
sock .setsockopt (socket .SOL_SOCKET , socket .SO_REUSEADDR , 1 )
280
- sock .setsockopt (socket .SOL_SOCKET , socket .SO_REUSEPORT , 1 )
280
+
281
+ # Option not supported on Windows.
282
+ if hasattr (socket , "SO_REUSEPORT" ):
283
+ sock .setsockopt (socket .SOL_SOCKET , socket .SO_REUSEPORT , 1 )
281
284
282
285
# set how to receive timestamps
283
286
try :
You can’t perform that action at this time.
0 commit comments