#11 (permalink)  
Old 09-11-07, 08:50
Member
Settled In
 
Join Date: Oct 2007
Posts: 44
Rep Power: 0
Enzuccio is on a distinguished road
Riferimento: as3 ed i socket

Ho intenzione di creare una chat con comunicazione socket.
Cioè la cosa che mi fa rabbia è che da ambiente cs3 funge, ho provato anche in rete, facendolo lanciare ad un amico da casa sua, e riesce a collegarsi al server che ho io in locale...poi dall'html non và!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
sponsor links
Flashmint flash templates FlippingBook-PDF publisher Flash Media Server Hosting
  #12 (permalink)  
Old 09-11-07, 08:52
Administrator
Living At The FlepStudio!
 
Join Date: Jul 2007
Location: Cesenatico
Posts: 4,917
Rep Power: 7
Flep is on a distinguished road
Re: as3 ed i socket

Per i sockets e le chats ci vorrebbe Flash Remoting.
__________________
_________________________________________
VIDEO CORSI ACTIONSCRIPT 3.0 creati da FlepStudio
I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread please !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 09-11-07, 08:52
Member
Settled In
 
Join Date: Oct 2007
Posts: 44
Rep Power: 0
Enzuccio is on a distinguished road
Riferimento: as3 ed i socket

Provandolo con il debug di firefox mi ha dato questo errore:

SecurityError: Error #2010: I file SWF local-with-filesystem non sono autorizzati a utilizzare i socket.
at flash.net: ocket/connect()
at flash.net: ocket$iinit()
at ::CustomSocket$iinit()
at socketExample$iinit()
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 09-11-07, 08:58
Administrator
Living At The FlepStudio!
 
Join Date: Jul 2007
Location: Cesenatico
Posts: 4,917
Rep Power: 7
Flep is on a distinguished road
Re: as3 ed i socket

The Socket class enables ActionScript code to make socket connections and to read and write raw binary data. It is similar to XMLSocket but does not dictate the format of the received or transmitted data.
The Socket class is useful for working with servers that use binary protocols.

When you use this class, consider the Flash Player security model:

Data loading is not allowed if the calling SWF file is in the local-with-file-system sandbox and the target resource is from a network sandbox.
Data loading is also not allowed if the calling SWF file is from a network sandbox and the target resource is local.
The calling SWF file and the network resource being accessed must be in exactly the same domain. For example, a SWF file at adobe.com can connect only to a server daemon at adobe.com.
Websites can permit cross-domain access to a resource through a cross-domain policy file.
__________________
_________________________________________
VIDEO CORSI ACTIONSCRIPT 3.0 creati da FlepStudio
I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread please !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 09-11-07, 09:00
Administrator
Living At The FlepStudio!
 
Join Date: Jul 2007
Location: Cesenatico
Posts: 4,917
Rep Power: 7
Flep is on a distinguished road
Re: as3 ed i socket

Questo è interessante:
lessrain blog » Blog Archive » AS3 + Java: Socket connections to ports below 1024
__________________
_________________________________________
VIDEO CORSI ACTIONSCRIPT 3.0 creati da FlepStudio
I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread please !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 09-11-07, 09:01
Administrator
Living At The FlepStudio!
 
Join Date: Jul 2007
Location: Cesenatico
Posts: 4,917
Rep Power: 7
Flep is on a distinguished road
Re: as3 ed i socket

Anche questo:
Flash Cross-Domain File - Google Data API | Google Groups
__________________
_________________________________________
VIDEO CORSI ACTIONSCRIPT 3.0 creati da FlepStudio
I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread please !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 09-11-07, 10:23
Member
Settled In
 
Join Date: Oct 2007
Posts: 44
Rep Power: 0
Enzuccio is on a distinguished road
Riferimento: as3 ed i socket

Ti ringrazio flep per l'interessamento.
Stò continuando a sbariare...purtroppo ancora nulla!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 09-11-07, 13:13
Member
Settled In
 
Join Date: Oct 2007
Posts: 44
Rep Power: 0
Enzuccio is on a distinguished road
Riferimento: as3 ed i socket

Caro Flep,
dopo svariati tentativi, sono riuscito a risolvere il problema della policy. Ora non mi da più problemi per quanto riguarda questo aspetto.
Ma purtroppo ne sorge un altro: praticamente non avviene il collegamento. Nel file swf corrispondente ho messo un pò di caselle di testo di prova per stampare gli eventuali errori.

Ti posto il codice modificato:

Code:
package {
 import flash.display.Sprite;
 import flash.text.*;
 import flash.system.Security;
 import flash.net.*;
 import flash.events.*;
 import flash.errors.*;

 public class socketExample extends Sprite {
  public function socketExample() {
   Security.loadPolicyFile("xmlsocket://XX.XX.XX.XX:80");
   var socket:CustomSocket = new CustomSocket("XX.XX.XX.XX",1500);
   CustomSocket.casella=this;
   connessione.text="NON CONNESSO";
  }
 }
}
import flash.errors.*;
import flash.events.*;
import flash.net.Socket;
import flash.text.*;
class CustomSocket extends Socket {
 private var response:String;
 public static  var casella;
 public function CustomSocket(host:String = null, port:uint = 0) {
  super(host, port);
  configureListeners();
 }
 private function configureListeners():void {
  addEventListener(Event.CLOSE, closeHandler);
  addEventListener(Event.CONNECT, connectHandler);
  addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
  addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
  addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);
 }
 private function writeln(str:String):void {
  str += "\n";
  try {
   writeUTFBytes(str);
  } catch (e:IOError) {
   trace(e);
  }
 }
 private function sendRequest():void {
  trace("sendRequest");
  response = "";
  writeln("GET /");
  flush();
 }
 private function readResponse():void {
  var str:String = readUTFBytes(bytesAvailable);
  response += str;
  casella.prova.text=response;
 }
 private function closeHandler(event:Event):void {
  trace("closeHandler: " + event);
  trace(response.toString());
 }
 private function connectHandler(event:Event):void {
  casella.connessione.text="CONNESSO";//connectHandler: " + event;
  sendRequest();
 }
 private function ioErrorHandler(event:IOErrorEvent):void {
  casella.erroreIO.text="ioErrorHandler: " + event;
 }
 private function securityErrorHandler(event:SecurityErrorEvent):void {
  casella.erroreSe.text="securityErrorHandler: " + event;
 }
 private function socketDataHandler(event:ProgressEvent):void {
  trace("socketDataHandler: " + event);
  readResponse();
 }
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 09-11-07, 17:26
Administrator
Living At The FlepStudio!
 
Join Date: Jul 2007
Location: Cesenatico
Posts: 4,917
Rep Power: 7
Flep is on a distinguished road
Re: as3 ed i socket

Ciao Enzuccio, a me sembra tutto ok in Actionscript... lato server è tutto ok ?
__________________
_________________________________________
VIDEO CORSI ACTIONSCRIPT 3.0 creati da FlepStudio
I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread please !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 12-11-07, 13:54
Member
Settled In
 
Join Date: Oct 2007
Posts: 44
Rep Power: 0
Enzuccio is on a distinguished road
Riferimento: as3 ed i socket

Lato server è sempre tutto ok.
C'è sempre il problema che in ambiente cs3 funziona. Quando compilo e lancio da html, non va!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
sponsor links
Reply

Bookmarks

Tags
as3, socket

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Actionscript 3 Classe Socket enefein Actionscript 3.0 avanzato 1 24-09-08 17:20
Actionscript 3 sandbox, policyfile e socket z4g0 Actionscript 3.0 avanzato 0 26-06-08 14:23
ftp client & socket nootropic.kint Actionscript 3.0 avanzato 1 04-12-07 16:21



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
vBulletin Skin developed by: vBStyles.com
FlepStudio 2007-2009