לוגו אתר Fresh          
 
 
  אפשרות תפריט  ראשי     אפשרות תפריט  צ'אט     אפשרות תפריט  מבזקים     אפשרות תפריט  צור קשר     חץ שמאלה ‎print ‎"Hello World!"; if‎ ‎not rules.‎know ‎then rules.‎read(); חץ ימינה  

לך אחורה   לובי הפורומים > מחשבים > תכנות ובניית אתרים
שמור לעצמך קישור לדף זה באתרי שמירת קישורים חברתיים
תגובה
 
כלי אשכול חפש באשכול זה



  #1  
ישן 20-11-2008, 22:10
  itzikc20 itzikc20 אינו מחובר  
 
חבר מתאריך: 10.04.05
הודעות: 235
שימוש בסוקטים

יש לי את הקוד הבא:
קוד PHP:
<?php
error_reporting 
(E_ALL);
/* Allow the script to hang around waiting for connections. */
set_time_limit (0);
/* Turn on implicit output flushing so we see what we're getting
* as it comes in. */
ob_implicit_flush ();
$address "85.250.102.180";
$port 80;
if ((
$sock socket_create (AF_INETSOCK_STREAM0)) < 0) {
echo 
"socket_create() failed: reason: " socket_strerror ($sock) . "\n";
}
if ((
$ret socket_bind ($sock$address$port)) < 0) {
echo 
"socket_bind() failed: reason: " socket_strerror ($ret) . "\n";
}
if ((
$ret socket_listen ($sock5)) < 0) {
echo 
"socket_listen() failed: reason: " socket_strerror ($ret) . "\n";
}
do {
if ((
$msgsock socket_accept($sock)) < 0) {
echo 
"socket_accept() failed: reason: " socket_strerror ($msgsock) . "\n";
break;
}
/* Send instructions. */
$msg "\nWelcome to the PHP Test Server. \n" .
"To quit, type 'quit'. To shut down the server type 'shutdown'.\n";
socket_write($msgsock$msgstrlen($msg));
do {
if (
FALSE === ($buf socket_read ($msgsock2048))) {
echo 
"socket_read() failed: reason: " socket_strerror ($ret) . "\n";
break 
2;
}
if (!
$buf trim ($buf)) {
continue;
}
if (
$buf == 'quit') {
break;
}
if (
$buf == 'shutdown') {
socket_close ($msgsock);
break 
2;
}
$talkback "PHP: You said '$buf'.\n";
socket_write ($msgsock$talkbackstrlen ($talkback));
echo 
"$buf\n";
} while (
true);
socket_close ($msgsock);
} while (
true);
socket_close ($sock);
?>


אני מקבל את השגיאה הבאה:


Warning: socket_bind() [function.socket-bind]: unable to bind address [99]: Cannot assign requested address in /home/itzikc20/domains/itzikc20.kuchi.be/public_html/sec/sock.php on line 13

למה?
_____________________________________
חתימתכם הוסרה כיוון שלא עמדה בחוקי האתר. לפרטים נוספים לחצו כאן. תוכלו לקבל עזרה להתאמת החתימה לחוקים בפורום חתימות וצלמיות.

תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
  #5  
ישן 22-11-2008, 21:04
  itzikc20 itzikc20 אינו מחובר  
 
חבר מתאריך: 10.04.05
הודעות: 235
בתגובה להודעה מספר 4 שנכתבה על ידי yoavmatchulsky שמתחילה ב "יכול להיות שזה לא יצר טוב את..."

ציטוט:
במקור נכתב על ידי yoavmatchulsky
יכול להיות שזה לא יצר טוב את הסוקט?
הבדיקת ERROR שלך צריכה להיות עם הערך המוחזר הוא FALSE (עדיף עם ===), לא אם זה קטן מ0..

עשיתי את זה זה הקוד החדש ואני עדיין מקבל שגיאה:
קוד PHP:
<?php
error_reporting 
(E_ALL);
/* Allow the script to hang around waiting for connections. */
set_time_limit (0);
/* Turn on implicit output flushing so we see what we're getting
* as it comes in. */
ob_implicit_flush ();
$address "www.walla.com";
$port 80;
if ((
$sock socket_create (AF_INETSOCK_STREAM0)) == FALSE) {
echo 
"socket_create() failed: reason: " socket_strerror ($sock) . "\n";
}
if ((
$ret socket_bind ($sock$address$port)) == FALSE) {
echo 
"socket_bind() failed: reason: " socket_strerror ($ret) . "\n";
}
if ((
$ret socket_listen ($sock5)) == FALSE) {
echo 
"socket_listen() failed: reason: " socket_strerror ($ret) . "\n";
}
do {
if ((
$msgsock socket_accept($sock)) == FALSE) {
echo 
"socket_accept() failed: reason: " socket_strerror ($msgsock) . "\n";
break;
}
/* Send instructions. */
$msg "\nWelcome to the PHP Test Server. \n" .
"To quit, type 'quit'. To shut down the server type 'shutdown'.\n";
socket_write($msgsock$msgstrlen($msg));
do {
if (
FALSE === ($buf socket_read ($msgsock2048))) {
echo 
"socket_read() failed: reason: " socket_strerror ($ret) . "\n";
break 
2;
}
if (!
$buf trim ($buf)) {
continue;
}
if (
$buf == 'quit') {
break;
}
if (
$buf == 'shutdown') {
socket_close ($msgsock);
break 
2;
}
$talkback "PHP: You said '$buf'.\n";
socket_write ($msgsock$talkbackstrlen ($talkback));
echo 
"$buf\n";
} while (
true);
socket_close ($msgsock);
} while (
true);
socket_close ($sock);
?>


Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit in safe mode in /home/itzikc20/domains/itzikc20.kuchi.be/public_html/1.php on line 4

Warning: socket_bind() [function.socket-bind]: unable to bind address [99]: Cannot assign requested address in /home/itzikc20/domains/itzikc20.kuchi.be/public_html/1.php on line 13
socket_bind() failed: reason: Success

לצפיייה בדף בשרת שלי:
http://itzikc20.kuchi.be/1.php
_____________________________________
חתימתכם הוסרה כיוון שלא עמדה בחוקי האתר. לפרטים נוספים לחצו כאן. תוכלו לקבל עזרה להתאמת החתימה לחוקים בפורום חתימות וצלמיות.

תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
תגובה

כלי אשכול חפש באשכול זה
חפש באשכול זה:

חיפוש מתקדם
מצבי תצוגה דרג אשכול זה
דרג אשכול זה:

מזער את תיבת המידע אפשרויות משלוח הודעות
אתה לא יכול לפתוח אשכולות חדשים
אתה לא יכול להגיב לאשכולות
אתה לא יכול לצרף קבצים
אתה לא יכול לערוך את ההודעות שלך

קוד vB פעיל
קוד [IMG] פעיל
קוד HTML כבוי
מעבר לפורום



כל הזמנים המוצגים בדף זה הם לפי איזור זמן GMT +2. השעה כעת היא 19:10

הדף נוצר ב 0.04 שניות עם 11 שאילתות

הפורום מבוסס על vBulletin, גירסא 3.0.6
כל הזכויות לתוכנת הפורומים שמורות © 2025 - 2000 לחברת Jelsoft Enterprises.
כל הזכויות שמורות ל Fresh.co.il ©

צור קשר | תקנון האתר