[Translation] PHP and Socket
Article: PHP and SocketTitle: PhP game programmingAuthor: Matt rutledgetTranslation: heiyeluren
◇ Socket Basics◇ Generate a server◇ Generate a client
In this chapter, you will understand the fascinating and confusing
Source: http://blog.csdn.net/heiyeshuwu/archive/2005/08/16/456000.aspx
[Translation] PHP and Socket
Article: PHP and SocketTitle: PhP game programmingAuthor: Matt rutledgetTranslation: heiyeluren
◇ Socket Basics◇ Generate a server◇ Generate a
Finally, edit the charming and confusing socket (Sockets) of jguon ). Sockets is not fully utilized in PHP. Today, you will see a server that can connect to the client and connect to the client using socket. The server sends detailed processing
Warning:socket_create (): Unable to create socket [94]: Socket type not supported in/web/xxx/apicookie.php on line 16
Warning:socket_connect () expects parameter 1 to BES resource, boolean given in/web/xxx/apicookie.php on line 28
This is the
Novice help, socket unable to create socket
Warning:socket_create (): Unable to create socket [94]: Socket type not supported in/web/xxx/apicookie.php on line 16
Warning:socket_connect () expects parameter 1 to BES resource, boolean given in/web/xxx/
PHP Socket Programming Detailed
This article mainly introduces the PHP socket programming detailed, the need for friends can refer to the following
1. Pre-knowledge
It has been very rare to see how many people use the PHP socket module to do
The code under Windows is as follows
Server.cpp #include
Client.cpp #include
The following code for Linux is as follows:Makefile
CLI=CLI
ser=ser
dir=.
cc=g++
ser_obj=$ (dir)/ser.o
cli_obj=$ (dir)/cli.o ser_src=$
(dir)/ser.cpp
1. basic structure of socketsstruct SOCKADDRThis structure is used to store socket addresses.Data definition:struct SOCKADDR {unsigned short sa_family; /* Address family, AF_XXX */Char sa_data[14]; /* Protocol address for bytes */};Sa_family in
Preface PHP socket connection function has three kinds of schemes
1. Socket integrated in the kernel
Fsockopen
Pfsockopen
2, PHP extension module with the socket function, compile PHP must be in the configuration -
Php socket programming and socket programming
1. Prerequisites
I have never seen how many people use the socket module of php to do some things. Maybe everyone has positioned it within the scope of the script language, but in fact, the php socket
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.