CakeFest 2024: The Official CakePHP Conference

socket_strerror

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

socket_strerrorBir soket hatasıyla ilgili açıklamayı döndürür

Açıklama

socket_strerror(int $hata_kodu): string

socket_strerror() işlevi hata_kodu bağımsız değişkeninde socket_last_error() işlevinden döndürülen bir hata kodunu alır ve bununla ilgili açıklamayı döndürür.

Bilginize:

Bu işlevle ilgili sistem iletileri yerele bağlı olarak (LC_MESSAGES) gösterilse de bu eklentinin ürettiği hata iletileri ingilizcedir.

Bağımsız Değişkenler

hata_kodu

socket_last_error() işlevinden dönen bir hata numarası.

Dönen Değerler

hata_kodu ile ilgili hata iletisini döndürür.

Örnekler

Örnek 1 - socket_strerror() örneği

<?php
if (false == ($socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) {
echo
"socket_create() başarısız oldu: Sebep: " .
socket_strerror(socket_last_error()) . "\n";
}

if (
false == (@socket_bind($socket, '127.0.0.1', 80))) {
echo
"socket_bind() başarısız oldu: Sebep: " .
socket_strerror(socket_last_error($socket)) . "\n";
}
?>

Betiğin root yetkileriyle çalışmadığı varsayımıyla çıktı şöyle olurdu:

socket_bind() başarısız oldu: Sebep: Permission denied

Ayrıca Bakınız

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top