View Full Version : Access DiscountASP pop account via Flash ActionScript 3.0
wisemx
04-01-2008, 12:06 AM
Hi,
It's been years since I did anything with this but do you think the problem may be the socket and byte mix type?
You can probably find some references to make sure, on the Adobe site.
btw, I used to really like the developer support section on the Macromedia site a lot better. http://community.discountasp.net/emoticons/wink.gif
Anyway, from memory, which isn't that good to tell the truth...
The readUTFBytes and writeUTFBytes methods only work if the text is UTF encoded.
And those methods are not the same as the readByte, readBytes, writeByte, and writeBytes methods.
As if that could be any more confusing. http://community.discountasp.net/emoticons/wink.gif
Salute,
Mark
dotNET
04-01-2008, 12:33 AM
Hi there,
Thanks for the reply.
Adobe says the following about the method "readByte()"...
Reads a signed byte from the socket.
Returns
int (file:///C:/Documents%20and%20Settings/All%20Users/Application%20Data/Adobe/Flash%20CS3/en/Configuration/HelpPanel/Help/ActionScriptLangRefV3/int.html) ? A value from -128 to 127.
...so as far as I know I would need to use "readUTFBytes()" method.
Similar issue with "writeUTFBytes()" which allows me to specify a string asthe parameter, but "writeBytes()" only allows a integer to be specified.
All so confusing! There's nothing more frustrating than being shown something in a tutorial and then finding you can't implement it on your own setup!! :)
Any help appreciated.
Kind regards,
M.
I am a web developer working in the South-East of England.
My skill set includes:
- ASP.NET 2.0 (C#)
- Classic ASP (VBScript)
- SQL Server 2005
- PHP
- XML
- XHTML
- CSS
- JavaScript
- AJAX
- AIR
- Flex
- Flash (ActionScript 2.0/3.0)
- Photoshop
- Illustrator
- Fireworks
wisemx
04-01-2008, 01:37 AM
I'll do some digging for you mate.
Don't know why but I woke up with a busting migraine this morning. http://community.discountasp.net/emoticons/rolleyes.gif
Salute,
Mark
dotNET
04-01-2008, 01:46 AM
Thanks mate! much appreciated :)
I know what you mean, I had a cracking headache all last night and this morning http://community.discountasp.net/emoticons/eyes.gif
I am a web developer working in the South-East of England.
My skill set includes:
- ASP.NET 2.0 (C#)
- Classic ASP (VBScript)
- SQL Server 2005
- PHP
- XML
- XHTML
- CSS
- JavaScript
- AJAX
- AIR
- Flex
- Flash (ActionScript 2.0/3.0)
- Photoshop
- Illustrator
- Fireworks
dotNET
04-01-2008, 07:45 AM
Hello,
I was watching the latest flash tutorialon www.gotoandlearn.com (http://www.gotoandlearn.com) about "Binary Sockets" and was having trouble setting this up using the server "storm-media.co.uk" domain rather than what the video tutorial uses which is "leebrimelow.com".
But if I try using "storm-media.co.uk, 110" then I get the following error message:
Error #2044: Unhandled IOErrorEvent:. text=Error #2031: Socket Error.
at Pop3_fla::MainTimeline/frame1()
....does anyone have any ideas on what the problem might be?
Many thanks in advanced! :)
Full code is below....
// Socket(host address of the server, which port do we want to connect to)
var s:Socket = new Socket("leebrimelow.com", 110);
// Everytime the server sends us something, SOCKET_DATA is the event that fires
s.addEventListener(ProgressEvent.SOCKET_DATA, sData);
// http://www.pnambic.com/Goodies/POP3Ref.html is a good reference for POP information
function sData(e:ProgressEvent):void
{
// Create a data string, UTFBytes is basically String data
// We connect using Binary but we know the receiving data is plain text format so we use UTFBytes
// bytesAvailable basically reads everything
var d:String = s.readUTFBytes(s.bytesAvailable);
trace(d);
/*
When writing commands, the new line '\n' is required for the server
to see that it's a valid command
*/
if(d.indexOf("+OK Hello there") != -1) // if this string exists
{
// Write this command into the buffer
s.writeUTFBytes("USER lee@leebrimelow.com\n");
}
if(d.indexOf("+OK Password required") != -1) // if this string exists
{
// Write this command into the buffer
s.writeUTFBytes("PASS mypassword\n");
}
if(d.indexOf("+OK logged in") != -1) // if this string exists
{
// Write this command into the buffer
// Use reference URL for different commands
// We can use RETRIEVE to pull in the first email in our inbox
s.writeUTFBytes("RETRIEVE 1 \n");
}
// Send the command to the server
s.flush();
}
I am a web developer working in the South-East of England.
My skill set includes:
- ASP.NET 2.0 (C#)
- Classic ASP (VBScript)
- SQL Server 2005
- PHP
- XML
- XHTML
- CSS
- JavaScript
- AJAX
- AIR
- Flex
- Flash (ActionScript 2.0/3.0)
- Photoshop
- Illustrator
- Fireworks
raymondp
04-01-2008, 10:09 AM
Is this the pop server 'leebrimelow.com'? You should try using the pop3 server which is pop3.storm-media.co.uk. Using storm-media.co.uk won't work cause you're trying to access the web server. Remember the pop sever and web server are two different servers.
rcp
DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)
dotNET
04-01-2008, 10:28 AM
Thank you! that did the trick :)
Kind regards,
Mark
I am a web developer working in the South-East of England.
My skill set includes:
- ASP.NET 2.0 (C#)
- Classic ASP (VBScript)
- SQL Server 2005
- PHP
- XML
- XHTML
- CSS
- JavaScript
- AJAX
- AIR
- Flex
- Flash (ActionScript 2.0/3.0)
- Photoshop
- Illustrator
- Fireworks
dotNET
04-01-2008, 11:01 AM
Hello again,
I'm now onto the next stage of my problem.
When I run the below code I get a response back from the server that says...
+OK POP3 server ready <112d3161-ee1b-4535-a82e-ff63a1d3075a>
...but after that nothing happens (even though I'm sending another command - in this case my username - to the server to respond to)?
Any ideas?
Ta!
M.
// Socket(host address of the server, which port do we want to connect to)
var s:Socket = new Socket("pop3.storm-media.co.uk", 110);
// Everytime the server sends us something, SOCKET_DATA is the event that fires
s.addEventListener(ProgressEvent.SOCKET_DATA, sData);
// http://www.pnambic.com/Goodies/POP3Ref.html is a good reference for POP information
function sData(e:ProgressEvent):void
{
// Create a data string, UTFBytes is basically String data
// We connect using Binary but we know the receiving data is plain text format so we use UTFBytes
// bytesAvailable basically reads everything
var d:String = s.readUTFBytes(s.bytesAvailable);
trace(d);
/*
When writing commands, the new line '\n' is required for the server
to see that it's a valid command
*/
if(d.indexOf("+OK POP3 server ready") != -1) // if this string exists
{
// Write this command into the buffer
s.writeUTFBytes("USER mark@storm-media.co.uk\n");
}
// Send the command to the server
s.flush();
}
I am a web developer working in the South-East of England.
My skill set includes:
- ASP.NET 2.0 (C#)
- Classic ASP (VBScript)
- SQL Server 2005
- PHP
- XML
- XHTML
- CSS
- JavaScript
- AJAX
- AIR
- Flex
- Flash (ActionScript 2.0/3.0)
- Photoshop
- Illustrator
- Fireworks
raymondp
04-01-2008, 11:36 AM
Try bypassing the 'if' condition statement. Now that we know your app connects to the pop server go straight to the 's.writeUTFBytes('USER mark@storm-media.co.uk\n');' line. I have a feeling that your IF condition is the point were your application is failing.
rcp
DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)
dotNET
04-01-2008, 11:48 AM
Hi there,
No sorry that didn't do anything :(
It just hangs there? I'm flushing the USER command to thepop server so the server must have some kind of response but it just sits there?
I think in the tutorial it mentions about a crossdomain.xml file so I'm going to take a look at that shortly.
Kind regards,
M.
I am a web developer working in the South-East of England.
My skill set includes:
- ASP.NET 2.0 (C#)
- Classic ASP (VBScript)
- SQL Server 2005
- PHP
- XML
- XHTML
- CSS
- JavaScript
- AJAX
- AIR
- Flex
- Flash (ActionScript 2.0/3.0)
- Photoshop
- Illustrator
- Fireworks
dotNET
04-01-2008, 11:52 AM
Nope, sorry, my previous post about the crossdomain.xml is only valid if I'm running the application online but at the moment I'm simply running from my local machine so crossdomain.xml wont matter here.
Anyone got any ideas why the discountasp.net pop server doesn't respond to the USER command?
Many thanks!
Kind regards,
M.
I am a web developer working in the South-East of England.
My skill set includes:
- ASP.NET 2.0 (C#)
- Classic ASP (VBScript)
- SQL Server 2005
- PHP
- XML
- XHTML
- CSS
- JavaScript
- AJAX
- AIR
- Flex
- Flash (ActionScript 2.0/3.0)
- Photoshop
- Illustrator
- Fireworks
bruce
04-02-2008, 07:38 AM
M.
Which part of the UK are you in?
Is .NET very popular in Europe? or people still prefer UNIX hosting?
Bruce
DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)
dotNET
04-03-2008, 06:47 AM
Hi there Bruce,
I'm from the South-East of the UK (Essex, right outside London).
Yeah definitely ASP.NET is big inthe UK (not sure about the whole of europe but from all the data I've seen over the past 4yrs it looks like other programming languages are the downslide compared to .NET).
Why do you ask?
ta!
M.
I am a web developer working in the South-East of England.
My skill set includes:
- ASP.NET 2.0 (C#)
- Classic ASP (VBScript)
- SQL Server 2005
- PHP
- XML
- XHTML
- CSS
- JavaScript
- AJAX
- AIR
- Flex
- Flash (ActionScript 2.0/3.0)
- Photoshop
- Illustrator
- Fireworks
bruce
04-08-2008, 08:19 AM
Just curious. I used to study in Dover some 20 years ago. So i wonder if you live around there :)
Bruce
DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)
vBulletin® ©Jelsoft Enterprises Ltd.