doc 8
New Member
Hi
Hard to know where to post this and I don't want to double post it - please move it if you need to,
I am trying to connect a Flash client socket (XML) to a php socket server (using Flash 8 and php 5).
My php socket server responds correctly when I connect to it with a php client socket but I cannot connect with the flash xml client socket.
Both codes are included below - they are both in the same folder on the web site and I am only trying to get them to connect.
Cheers
doc
THE PHP SOCKET SERVER (run on browser for the moment - daemon later when sorted!)
<?php
// set some variables
$host = "my ip address";
$port = 1234;
// don't timeout!
set_time_limit( 0);
// create socket
$socket = socket_create(A F_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n");
// bind socket to port
$result = socket_bind($so cket, $host, $port) or die("Could not bind to socket\n");
// start listening for connections
$result = socket_listen($ socket, 5) or die("Could not set up socketlistener\ n");
// accept incoming connections
// spawn another socket to handle communication
$spawn = socket_accept($ socket) or die("Could not accept incomingconnect ion\n");
// read client input
$input = socket_read($sp awn, 1024) or die("Could not read input\n");
$output = "Hello"."\0 ";
socket_write($s pawn, $output, strlen ($output)) or die("Could not write output\n");
// close sockets
socket_close($s pawn);
socket_close($s ocket);
?>
THE FLASH CLIENT SERVER (this is a one frame swf run on a simple web page)
<code>
mySocket = new XMLSocket();
mySocket.onConn ect = function(succes s) {
if (success) {msgArea.htmlTe xt += "<b>Server connection established!</b>";} else {
msgArea.htmlTex t += "<b>Server connection failed!</b>";}
}
mySocket.onClos e = function() {
msgArea.htmlTex t += "<b>Server connection lost</b>";
}
mySocket.protot ype.onData = function(msg) {
msgArea.htmlTex t += msg;
}
mySocket.connec t("my ip address", 1234);
</code>
0 2413 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: User |
last post by:
Hi,
I tried to find the information over the internet but didn't find any
answers.
I'm looking for a server side code example of winsock accepting many
clients. I know that in VB.NET it is not implemented like in VB6. What
I've done is one client per socket. Meaning that each client used a
different port on the server, but I find it annoying.
|
by: John Sheppard |
last post by:
Hi all,
I am not sure that I am posting this in the right group but here it goes anyway. I am new to socket programming and I have been searching on the internet to the questions I am about to pose but have been unsuccessful in finding the answers so far. Either because my understanding of sockets isn't where it needs to be or my questions are too basic.
My programming environment is Windows XP, Visual Studio .NET 2003 and C#.
So here it...
|
by: Bruce W.1 |
last post by:
I want to put a live connection in a web page to periodically updated
data. When the data changes, the server notifys the client and gives
the new data. The client does not regularly refresh the page. The
client responds to server-side events only. The screen display changes
without any user interaction.
An application like this might be a chat, stock ticker, or data
inventory.
Sofar as I can tell nothing in the .NET framework can...
|
by: coloradowebdev |
last post by:
i am working on basically a proxy server that handles requests via remoting
from clients and executes transactions against a third-party server via TCP.
the remoting site works like a champ. my problem is executing the
transactions against the remote server and returning the response to the
remoting client. i can open the socket fine and, if i am executing one
transaction at a time, everything works great. it's when my proxy server...
|
by: DaTurk |
last post by:
I am makeing a Multicast server client setup and was wondering what the
difference is between Socket.Connect, and Socket.Bind.
It may be a stupid question, but I was just curious. Because I tried a
test, and I can't bind two sockets to the same port/ip but I can
connect with one socket, and bind with another to the same ip/port.
Thanks
| |
by: nephish |
last post by:
lo there,
i have a simple app that connects to a socket to get info from a server
i looks like this
serverhost = 'xxx.xxx.xxx.xxx'
serverport = 9520
aeris_sockobj = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
aeris_sockobj.connect((serverhost,serverport))
|
by: carl_bevil |
last post by:
I would like to use a single port to connect to a server. I would like
to be able to disconnect a socket using this port and then be able to
connect again (on the same port) immediately. I know there is a
TIME_WAIT value, but I thought I could get around it by using the
ResuseAddress option.
Here is what the code looks like (C#):
Socket connectSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
|
by: Uma - Chellasoft |
last post by:
Hai,
I am new to VB.Net programming, directly doing socket programming. In C, I
will be able to map the message arrived in a socket directly to a structure.
Is this possible in VB.Net. Can anyone please help me with some sample
codings and guidance?
Can you also suggest some other news group available for socket programming
in VB.Net?
|
by: doc |
last post by:
What will a flash xml client socket connect to?
I have a working php TCP/IP server socket bound to a port >1023 and the flash client will not even connect to it. I can connect to it with non-xml client.
Can anyone explain this to me - it has been driving me mad for weeks!
Please help!
Thanks
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |