Re: [SLUG] Perl IO::Socket question
Thanks for the buffering explanation, but unfortunately it's still not working. On 11/10/2007, Amos Shapira [EMAIL PROTECTED] wrote: On 11/10/2007, Shane Anderson [EMAIL PROTECTED] wrote: Hi, I don't believe it's IO buffering as $recv prints out fine if I don't do a chomp();, but I'll give it a shot. If the socket is in line buffering then maybe the newline at the end of $recv causes the buffer to be flushed. Try: $client-send(Works! Received: \$recv\\n); (I generally like to surround such output with quotes so you know where exactly to look for the string) Reading man IO::Socket on Debian Etch I see a big notice near the beginning: As of VERSION 1.18 all IO::Socket objects have autoflush turned on by default. This was not the case with earlier releases. So try maybe also $client-autoflush(1); (I'm not sure the $|=1 suggested by David would help, it's supposed to work only on the currently selected output stream). --Amos -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Perl IO::Socket question
Hi, I've removed the if statement that checks the hash so now the code looks like this: while (my ($client, $client_address) = $server-accept()) { $client-autoflush(1); my ($port, $packed_ip) = sockaddr_in($client_address); my $client_ip = inet_ntoa($packed_ip); my $stamp = timestamp; print LOGFILE $stamp - Client ($client_ip) connected.\n if $DEBUG == 1; $client-recv($recv, 128); #if (exists($commands{$recv})) { # $client-send(Works!); #} else { chomp($recv); $client-send(Doesn't work! - $recv - The command should appear before this.); #} } and I get the following output: [EMAIL PROTECTED]:~$ telnet localhost Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. hello -- i type this in. - The command should appear before this.Connection closed by foreign host. And below is the output when I don't do a chomp(); [EMAIL PROTECTED]:~$ telnet localhost Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. hello Doesn't work! - hello - The command should appear before this.Connection closed by foreign host. I hope this clears up what is happening. Thanks, Shane On 12/10/2007, Scott Ragen [EMAIL PROTECTED] wrote: $client-recv($recv, 128); chomp($recv); if (exists($commands{$recv})) { $client-send(Works! Received: $recv); } else { $client-send(Doesn't work! We received this: $recv); } } The code above doesn't print out anything for $recv, however if I remove the chomp($recv) it works fine. Anyone got any idea's why running a chomp on this variable causes it to not be displayed at all? The variable does contain a newline so I do need to have it removed. Hi Shane, Can you be a little more specific? When you chomp, do you get the Doesn't work return with nothing from $recv variable? When you don't chomp, do you also get Doesn't work returning the string from $recv variable? What I'm asking, is does the hash list also contain a new line, so when you chomp, it no longer matches? Regards, Scott -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Perl IO::Socket question
You're a champ Scott, works great now :) [EMAIL PROTECTED]:~$ telnet localhost Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. hello Doesn't work! - hello - The command should appear before this.Connectionclosed by foreign host. Thanks, Shane On 12/10/2007, Scott Ragen [EMAIL PROTECTED] wrote: Shane Anderson [EMAIL PROTECTED] wrote on 12/10/2007 09:45:02 AM: Hi, I've removed the if statement that checks the hash so now the code looks like this: while (my ($client, $client_address) = $server-accept()) { $client-autoflush(1); my ($port, $packed_ip) = sockaddr_in($client_address); my $client_ip = inet_ntoa($packed_ip); my $stamp = timestamp; print LOGFILE $stamp - Client ($client_ip) connected.\n if $DEBUG == 1; $client-recv($recv, 128); #if (exists($commands{$recv})) { # $client-send(Works!); #} else { chomp($recv); $client-send(Doesn't work! - $recv - The command should appear before this.); #} } It could be chomp is removing the newline, but not carriage return(?). Try instead of chomp this: $recv =~ s/\r\n//; or it may be ordered the other way, I can't remember: $recv =~ s/\n\r//; Regards, Scott -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
[SLUG] Perl IO::Socket question
Hi All, I'm attempting to learn IO::Socket and have hit a snag with this bit of code: while (my ($client, $client_address) = $server-accept()) { my ($port, $packed_ip) = sockaddr_in($client_address); my $client_ip = inet_ntoa($packed_ip); my $stamp = timestamp; print LOGFILE $stamp - Client ($client_ip) connected.\n if $DEBUG == 1; $client-recv($recv, 128); chomp($recv); if (exists($commands{$recv})) { $client-send(Works! Received: $recv); } else { $client-send(Doesn't work! We received this: $recv); } } The code above doesn't print out anything for $recv, however if I remove the chomp($recv) it works fine. Anyone got any idea's why running a chomp on this variable causes it to not be displayed at all? The variable does contain a newline so I do need to have it removed. Thanks, Shane -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Perl IO::Socket question
Hi, %commands defined much earlier in the program and I want to see if $recv matches a key in that array. That isn't the issue i'm having through. It doesn't matter if the logic fails, regardless $recv suddenly has nothing in it if I perform a chomp() on it. Thanks, Shane On 11/10/2007, Tony Sceats [EMAIL PROTECTED] wrote: I would have thought the following makes more sense if (defined($recv})) { chomp($recv); $client-send(Works! Received: $recv); } where's %commands coming from? On 10/11/07, Shane Anderson [EMAIL PROTECTED] wrote: Hi All, I'm attempting to learn IO::Socket and have hit a snag with this bit of code: while (my ($client, $client_address) = $server-accept()) { my ($port, $packed_ip) = sockaddr_in($client_address); my $client_ip = inet_ntoa($packed_ip); my $stamp = timestamp; print LOGFILE $stamp - Client ($client_ip) connected.\n if $DEBUG == 1; $client-recv($recv, 128); chomp($recv); if (exists($commands{$recv})) { $client-send(Works! Received: $recv); } else { $client-send(Doesn't work! We received this: $recv); } } The code above doesn't print out anything for $recv, however if I remove the chomp($recv) it works fine. Anyone got any idea's why running a chomp on this variable causes it to not be displayed at all? The variable does contain a newline so I do need to have it removed. Thanks, Shane -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Perl IO::Socket question
Hi, I don't believe it's IO buffering as $recv prints out fine if I don't do a chomp();, but I'll give it a shot. Thanks, Shane On 11/10/2007, David Lloyd [EMAIL PROTECTED] wrote: Shane, while (my ($client, $client_address) = $server-accept()) { my ($port, $packed_ip) = sockaddr_in($client_address); my $client_ip = inet_ntoa($packed_ip); my $stamp = timestamp; print LOGFILE $stamp - Client ($client_ip) connected.\n if $DEBUG == 1; $client-recv($recv, 128); chomp($recv); if (exists($commands{$recv})) { $client-send(Works! Received: $recv); } else { $client-send(Doesn't work! We received this: $recv); } } It could be IO buffering (this, btw, is a wild guess); try putting: $| = 1; As close to the beginning of the file/script as you can and see what happens. DSL 1) http://perl.plover.com/FAQs/Buffering.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
[SLUG] Re: Turning off MySQL replication permanently
Hi, I've managed to answer my own question, deleting master.info in the data directory stops replication. Thanks, Shane On 11/05/07, Shane Anderson [EMAIL PROTECTED] wrote: Hi All, I currently have a MySQL solution configured in the following manner: db01 - db-01-new - db-reporting-01 db01 is currently our main database server and is replicating down to our new soon-to-be main database server db-01-new which is in turn replicating our reporting database db-reporting-01. db-01-new is currently acting as both a master and a slave, but once it becomes the new main database server and db01 is decomissioned it will only be a master. Basically I'm concerned that once db-01-new becomes the main database server that someone will accidentally start up the database server on db01 again and perform a write which will be replicated down to db-01-new. I can't work out how to permanently disable db-01-new from being a slave. Performing a 'stop slave;' isn't viable as the MySQL daemon will startup as a slave again if it is restarted. I've tried setting MASTER_HOST, MASTER_USER, etc to null but MySQL doesn't seem to like that. I've googled for an answer and looked through the MySQL site, but can't find anything. Any idea's? Thanks, Shane -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
[SLUG] Turning off MySQL replication permanently
Hi All, I currently have a MySQL solution configured in the following manner: db01 - db-01-new - db-reporting-01 db01 is currently our main database server and is replicating down to our new soon-to-be main database server db-01-new which is in turn replicating our reporting database db-reporting-01. db-01-new is currently acting as both a master and a slave, but once it becomes the new main database server and db01 is decomissioned it will only be a master. Basically I'm concerned that once db-01-new becomes the main database server that someone will accidentally start up the database server on db01 again and perform a write which will be replicated down to db-01-new. I can't work out how to permanently disable db-01-new from being a slave. Performing a 'stop slave;' isn't viable as the MySQL daemon will startup as a slave again if it is restarted. I've tried setting MASTER_HOST, MASTER_USER, etc to null but MySQL doesn't seem to like that. I've googled for an answer and looked through the MySQL site, but can't find anything. Any idea's? Thanks, Shane -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Optus broadband
Hi, No you wont. They supply a D-Link 302G which has a built in PPPoE client and has a ethernet port on the modem. Use the web-based config to setup your user/pass and away you go. Shane On 01/07/2004, at 3:17 PM, Alan L Tyree wrote: Optus just rang me with a $100 kickback deal on broadband connection. They supply a Dlink modem. I'm running RH8 - am I going to have any hassles setting this up? Thanks for any comment, Alan -- -- Alan L Tyree http://www2.austlii.edu.au/~alan Tel: +61 2 4782 2670 Mobile: +61 405 084 990 Fax: +61 2 4782 7092 -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Optus broadband
Hi, Just for curiosities sake, what bodgey hardware are you referring to exactly? OptusNet don't support Mac officially for DSL, and connecting server's to the service (Cable or DSL) is definitely not cool. (http://www.optus.com.au/Vign/ViewMgmt/display/0,2627,1031_34766 -3_36739--View_303,FF.html#31) Shane On 01/07/2004, at 5:44 PM, ABD Computer Installations wrote: Alan , I deal both in ADSL and cable for my clients , and now Optus is not taking risks with bodgy hardware like the early days. They have to support Win and Mac so they have to be careful. I connect routers and servers to there service and It's cool. Only crap thing about Optus is they don't support Linux, this is your call. You have the makings of a successful broadband connection... Happy Interneting dude. -- Best Regards Mohammad Kaan ph: 0408 867 967 http://home.abdcomputers.net Regarding tough new Spam laws that have taken effect in Apr 2004. ABD Computer Installations hereby declares that this E-mail our E-mail system is completely free from Spam and viruses. We request recipients to place us in their white list of friendly E-mailers. This privilege was achieved through the use of Linux. -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [bedel@allmail.net: Re: [SLUG] Linux on an xbox]
Yes. If you are only after it to put linux on your xbox, then you're best bet is looking for it on Ebay. Mech Assault is also available for $50 new (which you can also use). I got mine from K-Mart. Shane Dave wrote: How about 007? Can you get that one in Australia? http://xbox-linux.sourceforge.net/docs/howtoexploit.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Linux on an xbox
Dean Hamstead wrote: i believe sony helped get linux going on playstation2, but youll need to google it. the xbox is a powerpc with an ati card. its biggest problem is that it doesnt have a hard disk (unlike ps2 and xbox) I'm guessing you mean't GameCube instead of xbox in reference to powerpc and ati card :) Here's a link for those who are interested : http://www.gc-linux.org/ Shane -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] optusnet cable modem.
Hi, I'm sure you'll be relieved to find it's not true. If you leave your modem unplugged for a few days you *may* need to call up tech support to have your modem reprovisioned which takes a maximum of 45min and costs you nothing. This can easily be confirmed by calling tech support and asking them. Anyone who says otherwise is talking complete and utter rubbish. Shane Shaun Oliver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi all, I'm interested in knowing what is actually involved in the initial setup for an optus cable modem. the reason I ask is because if for some reason accepting a power outage, you lose power to the modem for more than 12 hours, aparently optus need to come and reinitialise the modem again at a cost of aprox $160 or there abouts. does anyone actually know what they do to begin with, if so I'd love to know that way I can save me some dollars if I once in a while do something silly. thanks in advance. - -- Shaun Oliver I refuse to have a battle of wits with an unarmed person. email: [EMAIL PROTECTED] WEB: http://blindman.homelinux.org/ IRC: irc.awesomechat.net: IRCNICK: blindman -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQFAEjcU67hYtcFGIIcRAvwhAJ9KYjEFWjnzaKmPveQJntbKcoPXFgCfdWHV Wcd+aM016bW0ZZBQY64FhGk= =Rcuu -END PGP SIGNATURE- -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] file transfer with speed limit
Hi, You might want to check out Trickle (http://monkey.org/~marius/trickle/). I haven't used it myself so I don't know if it is exactly what you need. Freshmeat blurb: trickle is a lightweight, portable, per-application bandwidth shaper. It works in collaboration, has peak detection, and does smoothing. trickle works entirely in userland and does not require root to run. It has been developed on OpenBSD and is known to run on Linux, FreeBSD, and Solaris. -- Shane Gottfried Szing wrote: hi, maybe to pick up the discussion about the favorite tool in use, which has appeared two weeks ago on this list. does someone know a tool for file transfer which offers a way to limit the traffic speed? the problem is that i am using a dial up connection and during the download everything responds in slow motion. :(( so, my idea is to limit the download speed, eg 50% of the whole bandwidth, and the rest is dedicated for surfing and reading mails. protocol (scp, http, ftp, ...) does not matter, because i want to download the files from my on server. and i dont like to install with QOS and stuff like this. dont want to change my kernel config for this. TIA, gottfried -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] [OT] Banks, Telcos and ISPs.
Hi, Greg Cockburn wrote: Hi all, sorry for the off topic post, but I thought I would ask the opinions of like minded people. I am moving to Sydney in about a week, and am looking for a bank, telco and ISP. I have looked at Commonwealth Banks site, but it does not render properly in Konq or Moz, so I am going to presume that their internet banking doesn't work properly either. I use commbank and it works fine for me in Moz/Firebird and I think I remember it working correctly in Konq also. So are there any other banks you would reccommend that have excellent electronic facilities. (I currently do 99.99% of my banking electronically. EFT-POS, CC, Internet, little cash, no cheques) How about Telcos? I have been looking at Optus, any problems with them? What about Telstra? All I really need is a phone and someway of connecting a cable/ADSL/DSL modem. (Maybe some Digital TV in the future?). And ISPs. I want to get some form of high speed internet. I currently have a cable modem, fixed IP, reverse DNS, 256kbps/128kbps. With a 100G local traffic cap and 10G international traffic cap. The cable modem kinda acts like a bridge. (IP is on the machine the modem is connected to, not the modem). If you are after a cable internet then Optus is the best choice currently, althought the plans are nothing like you have currently. Downstream speed is uncapped while upstream is capped at 128. The data allowance per month on the new plans are 12GB on Standard and 20GB on the Pro plan. Dynamic IP. Are you looking at running servers, if so then Optus is not for you as they block port 80, 25 and a couple of others. You are better off getting DSL in that case. iiNet (www.iinet.net.au) have just released new plans which look pretty tasty. The standard speed for DSL is 512/128, although the new plans are offering 1.5/256 for a pretty good price. Is there something like this here? Does it depend where you live? Who gives the best service? Who do you use? Why? Yes, it depends where you live as to wether you are cable or DSL servicable. Not all phone exchanges are DSL servicable and depending on where you do move to you might have to pay more for DSL as you might not be in a Regional area. Thanks for all the help! Looking forward to arriving in Sydney. Greg Cya, Shane -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
[SLUG] New ListServ for Apple's MacOS X
Note to List Mod: If this post is not appropriate, my apologies, just let me know so I know for the future, and remove this comment if you do post this. Some of you may know that Apple is very likely to announce a new version of Apple MacOS X the Mach based OS originally derived from Jobs' NeXT/OpenStep OS within days. More than 18 months overdue, it appears the light at the end of the tunnel is fast approaching with an announcement due during the Macworld keynote in SanFran Wednesday. Apple has also just updated the license for the Open Source part of MacOS X, Darwin. The 3 main points that were stopping serious Open Source developers from committing to working on Darwin have been completely overhauled bringing nothing but praise and a new excitement from Open Source developers. To this end, the Mac EvangeList has created a new list for all those more interested in MacOS X. Find out more about the list here: http://www.macevangelist.com/xlist/. And yes, just in case you didn't know, I run the world's largest Mac email list from right here in Sydney. :) -- Shane Anderson The Mac EvangeList List Dad [EMAIL PROTECTED] ICQ: 78719415 http://www.macevangelist.com Ph. +612 8802 5023 Fx. +612 9475 4355 Mb. +614 1109 7447 -- SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/ More Info: http://slug.org.au/lists/listinfo/slug
[SLUG] Newbie Question from a Mac user - Dual Booting Win98 and Linux
Not another Newbie! Sorry guys, comes with the territory of using an OS that is growing rapidly in popularity :) Also, I'm a Mac user :) Now now, be nice :) I am actually Shane Anderson, the Mac EvangeList List Dad http://www.macevangelist.com. Anyway, I have just bought myself a nice new 900MHz Athlon and 2 HDs and I wish to run a dual boot system, Win98SE and Linux (Corel Dist.). I have had a problem that my searches on the web have discovered is common, I get 01 01 01 01 01 all over my screen after installing Linux on the 2nd drive, which is the slave of the main bus. The only way to get back to Win98 is to reinstall the darn thing. Now don't give me about running Windows, I probably dislike it more than the majority of you, but it has become a dreaded necessity to ensure my web sites look OK on a Windoze box, and using VPC is just not good enough, and besides, VPC doesn't overcome the gamma differences. So, I am fully prepared to wipe everything I have. I have only been using Win98 for a few days. Besides, using Windoze I should get used to having to constantly reinstall everything from scratch, right!? :) So what do I do? Oh, and remember, I am a Mac user. The GUI rules! :( Apologies if this is not an appropriate Q? for this list. Oh, any Mac loving SLUG want to come out and give me a hand?? Feel free, I have SUSE Linux 7.0 running on a Dual 500MHz G4 here :) No it doesn't support the 2nd CPU :( but it was worth tempting you, and it is _VERY_ quick anyway. Shane Anderson The Mac EvangeList List Dad [EMAIL PROTECTED] ICQ: 78719415 http://www.macevangelist.com Ph. +612 8802 5023 Fx. +612 9475 4355 -- SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/ More Info: http://slug.org.au/lists/listinfo/slug