Hi Lapo,
I am using Adobe AIR SDK 2 and trying to use the initUDP functionality. When I call unitUdp(new AirUDPManager(); with the correct settings in the config, or manually specifying the host\port I get the error:
ArgumentError: Error #2004: One of the parameters is invalid.
at flash.net::DatagramSocket/internalConnect()
at flash.net::DatagramSocket/connect()
at com.smartfoxserver.v2.bitswarm::AirUDPManager/initialize()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/bitswarm/AirUDPManager.as:92]
at com.smartfoxserver.v2::SmartFox/initUDP()[/Users/Lapo/Documents/Flex Builder 3/SFS2X_AS3_API/src/com/smartfoxserver/v2/SmartFox.as:587]
UDP Parameter Error
Wow! Pretty weird
The exception seems to be fired by the AIR Datagram class.
Can you please provide all the details of your project and maybe the source code? (via email if it's long or if you don't want to post it here)
I would like to know the exact version of the AIR sdk and settings of the project.
The exception seems to be fired by the AIR Datagram class.
Can you please provide all the details of your project and maybe the source code? (via email if it's long or if you don't want to post it here)
I would like to know the exact version of the AIR sdk and settings of the project.
Okay here is the only class currently:
The config contains this along with other things:
The build.xml is using <application xmlns="http://ns.adobe.com/air/application/2.0"> Although it is Adobe AIR 2.5 SDK in the readme.[/code]
Code: Select all
package
{
import com.luaye.console.C;
import com.smartfoxserver.v2.bitswarm.AirUDPManager;
import com.smartfoxserver.v2.core.SFSEvent;
import com.smartfoxserver.v2.requests.LoginRequest;
import com.smartfoxserver.v2.SmartFox;
import flash.display.Sprite;
import flash.net.DatagramSocket;
/**
* ...
* @author Josh C
*/
public class Main extends Sprite
{
private var sfs:SmartFox = new SmartFox();
public function Main():void
{
C.start(this, "~");
sfs.addEventListener(SFSEvent.CONNECTION, onConnection);
sfs.addEventListener(SFSEvent.CONNECTION_LOST, onConnectionLost);
sfs.addEventListener(SFSEvent.LOGIN, onLogin);
sfs.addEventListener(SFSEvent.LOGIN_ERROR, onLoginError);
sfs.addEventListener(SFSEvent.UDP_INIT, onUDPInit);
sfs.loadConfig("config/sfs-config.xml");
}
private function onConnection(e:SFSEvent):void
{
trace("Connected");
sfs.send(new LoginRequest("test"));
}
private function onConnectionLost(e:SFSEvent):void
{
trace("Connection lost");
}
private function onLogin(e:SFSEvent):void
{
trace("Login success");
sfs.initUDP(new AirUDPManager());
}
private function onLoginError(e:SFSEvent):void
{
trace("Login failed");
}
private function onUDPInit(e:SFSEvent):void
{
trace("UDP initialisation " + e.params.success ? "succeeded" : "failed");
}
private function trace(... args):void
{
C.info(args);
}
}
}
The config contains this along with other things:
Code: Select all
<udpIp>myhostname</udpIp>
<udpPort>9933</udpPort>
The build.xml is using <application xmlns="http://ns.adobe.com/air/application/2.0"> Although it is Adobe AIR 2.5 SDK in the readme.[/code]
Hi Lapo,
I created a Flex4 Air Application, configured it the same as my old one, and used your mxml and had no error... Went back to an Actionscript Project with the same configuration and it all blew up again! Really weird, it is an error with my system though, previously I could use the Datagram socket but just opening the socket and telling it to connect now says there is a parameter error.
Noticed a typo "[SFS - WARN] UPD initialization is already in progress!"
I'll keep trying to figure it out,
Thanks,
Josh[/code]
I created a Flex4 Air Application, configured it the same as my old one, and used your mxml and had no error... Went back to an Actionscript Project with the same configuration and it all blew up again! Really weird, it is an error with my system though, previously I could use the Datagram socket but just opening the socket and telling it to connect now says there is a parameter error.
Code: Select all
var sock:DatagramSocket = new DatagramSocket();
sock.connect("localhost", 9933);
Noticed a typo "[SFS - WARN] UPD initialization is already in progress!"
I'll keep trying to figure it out,
Thanks,
Josh[/code]
I didn't expect this but you might have caught the problem! :O
According to the Adobe docs, the DatagramSocket says:
http://help.adobe.com/en_US/air/referen ... l#connect()
This explains the error you reported from the DatagramSocket class.
Seems like only IP addresses are accepted
According to the Adobe docs, the DatagramSocket says:
remoteAddress:String — The IP address of the remote machine with which to establish a connection. This address can be an IPv4 or IPv6 address. If bind() has not been called, the address family of the remoteAddress, IPv4 or IPv6, is used when calling the default bind().
http://help.adobe.com/en_US/air/referen ... l#connect()
This explains the error you reported from the DatagramSocket class.
Seems like only IP addresses are accepted
Return to “SFS2X ActionScript 3 API”
Who is online
Users browsing this forum: No registered users and 20 guests