In "HS110_power_logger_03.bas", line 263:Dinosaur wrote:@badidea, dowloaded the zip and it compiles ok, but when I run it:
"Waiting for connection" and then quits with Error 141.
I could not find anywhere in the code where your IP detail is stored.
Without thoroughly reading all the code can you explain this please, so I can test it for a long duration.
retCon = hs110.connect("HS110-1", 9999)
Change "HS110-1" with your IP and try again.
Error 141 seems to be: "SIGPIPE, The SIGPIPE signal is sent to a process when it attempts to write to a pipe without a process connected to the other end." Or: "Write on a pipe with no one to read it".
BTW: Getting the code Windows compatible will be some work. My non-blocking connect() addition to SNC gives a few errors:
Code: Select all
C:\Tools\FreeBASIC-1.04.0-win32\fbc.exe -w all "HS110_power_logger_03.bas" (in directory: D:\Projects\FreeBASIC\hs110\HS110_power_logger)
D:\Projects\FreeBASIC\hs110\HS110_power_logger\inc\snc.bi(318) error 41: Variable not declared, fcntl in 'dim as long flags = fcntl(sock, F_GETFL, NULL)'
D:\Projects\FreeBASIC\hs110\HS110_power_logger\inc\snc.bi(321) error 3: Expected End-of-Line, found 'fcntl' in 'fcntl(sock, F_SETFL, flags or O_NONBLOCK)'
D:\Projects\FreeBASIC\hs110\HS110_power_logger\inc\snc.bi(339) error 14: Expected identifier, found 'socklen_t' in 'dim as socklen_t optlen = sizeof(optval)'
D:\Projects\FreeBASIC\hs110\HS110_power_logger\inc\snc.bi(340) warning 3(1): Passing different pointer types, at parameter 4 of GETSOCKOPT()
D:\Projects\FreeBASIC\hs110\HS110_power_logger\inc\snc.bi(340) error 41: Variable not declared, optlen in 'getsockopt(sock, SOL_SOCKET, SO_ERROR, @optval, @optlen)'
D:\Projects\FreeBASIC\hs110\HS110_power_logger\inc\snc.bi(349) error 9: Expected expression, found 'fcntl' in 'flags = fcntl(sock, F_GETFL, NULL)'
D:\Projects\FreeBASIC\hs110\HS110_power_logger\inc\snc.bi(351) error 3: Expected End-of-Line, found 'fcntl' in 'fcntl(sock, F_SETFL, flags and not(O_NONBLOCK))'
Compilation failed.