-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Hello, code example:
Class Test
{
public function getSocket(string $host, int $port): Socket
{
$cast = $this->getSockAddr($host, $port);
// ...
// bind socket from ffi
}
private function getSockAddr(string $host, int $port): CData
{
$port = (string)$port;
$addr = $this->ffi->new('struct sockaddr_in', false);
$addr->sin_family = self::AF_INET;
$addr->sin_port = $this->ffi->htons($port);
$this->fillInAddrFromHost($addr, $host);
return $this->ffi->cast("const struct sockaddr", $addr);
}
private function fillInAddrFromHost(CData $addr, string $host): void
{
$inAddr = inet_pton($host);
FFI::memcpy($addr->sin_addr, $inAddr, strlen($inAddr));
}
}If sockaddr_in create with persistent = true - bind return ENODATA.
It's normal? If execute all the code in one method - everything is fine with persistent = true.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels