From: Xing H. <hxi...@gm...> - 2014-05-17 14:28:07
|
Hi, I have found the root cause. On Sunos, the sock_stream = 2. There is already definition in socketsh.inc in free pascal source code. const { Socket types } {$ifdef sunos} SOCK_STREAM = 2; { stream socket } SOCK_DGRAM = 1; { datagram socket } SOCK_RAW = 4; { raw-protocol interface } SOCK_RDM = 5; { reliably-delivered message } SOCK_SEQPACKET = 6; { sequenced packet stream } {$else} SOCK_STREAM = 1; { stream (connection) socket } SOCK_DGRAM = 2; { datagram (conn.less) socket } SOCK_RAW = 3; { raw socket } SOCK_RDM = 4; { reliably-delivered message } SOCK_SEQPACKET = 5; { sequential packet socket } {$endif} So there is no need to redefine in ssfpc.inc. Best regards, 2014-05-13 11:53 GMT+08:00 Xing Hong <hxi...@gm...>: > Hello, > > I tried to test socket feature on Solaris 10 / FPC2.4.4. I got 10009 error > (Bad file number). Does anyone know how to solve? I will appreciate your > help. > > Code is as below. > > var > Sock: TTCPBlockSocket; > S: String; > begin > Sock := TTCPBlockSocket.Create; > Sock.CreateSocket; > Sock.EnableReuse(true); > Sock.SetLinger(true, 10000); > Sock.Bind('0.0.0.0', '12345'); > if Sock.LastError <> 0 then > begin > S := 'Error: ' + Sock.LastErrorDesc > + ' (' + IntToStr(Sock.LastError) + ')'; > FreeAndNil(Sock); > end > else > Sock.Listen; > end; > > Best regards, > |