473,387 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Fsock object value

Hi All,

I have been using fsockopen() in a function in a class. I am able to pass all the objects in a class to another page except the fsockopen () value. I have put the values of objects from the output print_r() as below

main pages Class objects
Cisco Object
(
[_hostname:private] => 10.10.1.49
[_password:private] => cisco123
[_username:private] => cisco
[_connection:private] => Resource id #3
[_data:private] => R3#
[_timeout:private] => 3
[_prompt:private] => #
)

Class values transfred to another page

Cisco Object
(
[_hostname:private] => 10.10.1.49
[_password:private] => cisco123
[_username:private] => cisco
[_connection:private] => 0
[_data:private] => R3#
[_timeout:private] => 3
[_prompt:private] => #
)

In all other pages the [_connection:private] value is resetting to 0. I have treid using class Cisco declaring class as SESSION. (session_register('cisco');) and global, but no hope.

Part of my code is

Expand|Select|Wrap|Line Numbers
  1. class Cisco
  2. {
  3.  
  4.     private $_hostname;
  5.     private $_password;
  6.     private $_username;
  7.     private $_connection;
  8.     private $_data;
  9.     private $_timeout;
  10.     private $_prompt;
  11.  
  12.     public function __construct($hostname, $password, $username, $timeout = 3)
  13.     {
  14.         $this->_hostname = $hostname;
  15.         $this->_password = $password;
  16.         $this->_username = $username;
  17.         $this->_timeout = $timeout;
  18. }
  19.  
  20. public function connect()
  21.     {
  22.  
  23.       $this->_connection = @fsockopen($this->_hostname, 23, $errno, $errstr,  $this->_timeout);
  24. // code continues ....
Thanks
Dec 20 '09 #1
3 1721
Markus
6,050 Expert 4TB
You cannot serialize a resource. You'll have to reopen the resource on each page request.
Dec 21 '09 #2
kovik
1,044 Expert 1GB
HTTP is stateless. You can't maintain connections from one request to another through normal methods.
Dec 21 '09 #3
Thanks for the reply
Dec 22 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
11
by: Vani Murarka | last post by:
Hi Everyone, Does .NET offer any collection class which will give me objects last *accessed* such that I may build a least-recently-used cache that kills off objects that haven't been used for...
9
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes...
5
by: Matthew | last post by:
I have a nice little Sub that saves data in a class "mySettings" to an XML file. I call it like so: Dim mySettings As mySettings = New mySettings mySettings.value1 = "someText" mySettings.value2...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
2
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
11
by: Andrus | last post by:
I'm implementing entity object which should populate its properties from database when property is first referenced. In RDL reports I use object properties like MyObject.MyProperty MyObject...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.