filesize() returns 0
Posted on
16th Feb 2014 07:03 pm by
admin
I have a socket program that runs in an infinite loop, listening for connections, in this socket I have a method, that is supposed to open a file and write to the file, but I am having issues. Each call to the socket happens about once every 1.5 seconds, and then, it writes to the socket, but for some reason, filesize is always returning "0" even when the file is 1.5kb in size.
I use a string var to to defiine the file and it's positions:
var $file = 'C:php_filesPhediatest.flv';
Why is it returning 0? It writes to the file fine, so why cant it get the correct size?
this function is ran about every 1.5 seconds, it is supposed to append the new data to the current file:
function dataRecieved($allclient, $socket, $buf) {
echo filesize($this->file)."nn";
$this->handle = fopen($this->file, "a+b");
if(filesize($this->file) < 1){
$buf = "FLV".pack('C', 1).pack('C', 1).pack('N', 9).pack('N', 9).$buf;
}
if(fwrite($this->handle, $buf)){
echo "Wrote to filen";
echo $buf;
}
fclose($this->handle);
}
No comments posted yet
Your Answer:
Login to answer
258
35
Other forums
Reading waves
Hi,
I am trying to find a way of finding the highs and lows on a graph line, the line points
Problem with php's rename function
So, i'm having a problem with the php rename function. Basically my script 'delete_user.php' attempt
How to use Ajax to verify data on a DB ?
Hello everyone, well i want to know how to check a value if it exists or not on a Data base and capt
Stats of viewers
Hello. I have a website in php and people can login. I want to make an admin control panel where u c
Inserting a check in checkbox from array value
Hello all,
I have a bit of code that works for a select option box, but does not work for my chec
CODE NOT WORKING
Code: [Select]<?php
//include shared codes
include '../lib/common.php';
include
sql error
I have been looking at this code for 20mins and can't work out what I am doing wrong. There is somet
b+ tree
Hi
can every body help me about b+ tree ?(insert & delete)
Create or replace package is ending ORA-21700
Database 9.2.0., patch 8 (9.2.0.8.0).
I trying run
create or replace package ....etc.
Unable to customise toolbar in FCK