LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-25-2012, 05:09 AM   #1
golden_boy615
Member
 
Registered: Dec 2008
Distribution: Ubuntu Fedora
Posts: 445

Rep: Reputation: 18
how to preventing sharing persistent socket with two different tabs of same browser


hello
I have problem with persistent socket in php my problem is when I open a new tab of firefox, opera or chrome (but not Internet explorer) they share an existing persistent socket which is opened with pfsockopen function by first tab and does not open new persistent socket (which is Internet explorer does) what should I do in firefox (or related explorers) or in my code to open new socket for each new tab.
this is my sample code:
PHP Code:
<meta http-equiv="refresh" content="2;url=?">
<?php
error_reporting
(0);
@
ini_set(‘display_errors’0);
$fp pfsockopen("192.168.1.30",7778$errno$errstr30);
stream_set_blocking $fp ) ;
if (
$fp) {
$out "Device-1;";
fwrite($fp$out);
$out_put fread($fp2048);
echo 
$out_put ;    
}else{
echo 
'0000';
}
?>
 
Old 03-26-2012, 02:12 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
I would suggest that this behaviour is positive and should not be deemed to be a "problem" at all. Your PHP code certainly has no say in how the browser chooses to manage the connections. You can tell a connection to be kept alive, or you can force it to shut, andything past that is outside of the remit of HTTP/1.1.

Does opening a new firefox window do anything? I presume not, but it's worth checking. Other than that, load a different profile, or a different browser. Privay modes are useful for quick ways of testing two different sessions from the same browser instance too.
 
Old 03-27-2012, 07:02 AM   #3
golden_boy615
Member
 
Registered: Dec 2008
Distribution: Ubuntu Fedora
Posts: 445

Original Poster
Rep: Reputation: 18
but I do not want this behavior in firefox (internet explorer does not do that) how can I prevent it??
 
Old 03-27-2012, 07:33 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you can't. you need to redefine your requirements and approach for this to not matter. I don't feel it is reasonable for you to want this.
 
Old 03-29-2012, 05:44 PM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
There are lots of things that don't behave the way we want them to. You can either hold your breath until you turn blue or they change it (what shade of blue do you like?), or you can adapt. Most of the rest of us find that adapting is a big part of the challenge. It's part of writing applications for portability.
--- rod.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] python -> web browser with multiple tabs devilboy09 Programming 2 03-02-2012 03:45 PM
want a file browser with multiple tabs sumeet inani Linux - Newbie 4 03-08-2009 11:38 PM
Preventing a browser from connecting to a site sholah Linux - Server 5 02-03-2007 03:08 PM
Preventing Socket Floods felosi Linux - Security 1 05-17-2006 04:03 PM
using tabs in default browser (konqueror) dav7500 Linux - Newbie 3 02-07-2006 08:25 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration