Link to home
Start Free TrialLog in
Avatar of appinities
appinities

asked on

How to create and Use Sockets in PHP?

Please help me to create single Socket and Socket Arrays in PHP . How to operate DataArrival Socket Connect, Socket Error, Socket Close events in PHP in detail.

-Thanks
ASKER CERTIFIED SOLUTION
Avatar of loopfinity
loopfinity

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of appinities
appinities

ASKER

Thanks "loopfinity" . Your reply is appreciable, But still ..lemme show you with an example what I want..

In visual basic 6.0 I am using a socking, its coding is like:

Im sending packets like:
Socket1.SendData (0), HextoAscii("02 03 8E 00 1A 00 00 00 07 00 01 00 00 00 01 01")

Open in new window


Here (0) is the Array of the socket..


Same thing for Data Arrival method in vb6.0 is:

Private Sub Sockm_DataArrival(ByVal Index As Variant, ByVal bytesTotal As Long)
On Error Resume Next
Dim TempString as String

Socket1.GetData Index, TempString, vbString
If  TempString = "2 1 9C 0 Then
   msgbox "Login Successfully"
Else
  msgbox "Login Failed"
Endif

Open in new window



Same thing I wann do with the PHP sockets.. so please show me "How can I use above codings in PHP sockets"?

-Thanks alot in Advance..
Sorry for double posting, Ijn the above code
Private Sub Sockm_DataArrival

Open in new window


is Actually

Private Sub Socket1_DataArrival

Open in new window

Avatar of Rob
Have you gone through the user manual?

http://php.net/manual/en/book.sockets.php
Thanks Tagit, that link should help me alot, but I want you to convert my above codes into PHP. Thanks
Ok letme reduce the complexity of my question...

What should be the codings for : -

Suppose I wanna create a socket (TCP sockets not HTTP) with 5 arrays and wanna Connect these arrays with "gateway.abcdxyz.com" with Port "9009"

Now, After successfully connectivity , I wanna send a string to connected server.. string is "hello are you there?"

Now, If the connected server reply to my request, then I wanna display those responded message which are coming from the Server..
Example:
If server responding "Yes I am here"

then, how can I get responded message and can display it ?

-Thanks :(
Lolz..Still no reply... Where are experts ???? :@
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks :)
no problem but why the B grade? works doesn't it?