Sponsored Content
Full Discussion: Problem with read & write
Top Forums Programming Problem with read & write Post 302087214 by Corona688 on Wednesday 30th of August 2006 11:23:11 AM
Old 08-30-2006
Quote:
Originally Posted by Hitori
If you are using sockets send() and recv() offer much greater control over your data transmission
But ordinary read and write should still work, yes? No reason for them to segfault without an error in the program. If my hunch is correct send() and recv() could suffer the same issues...

Check to make sure you're recieving the number of bytes you intended. I think you might be getting crazy numbers for filesize, which could cause the crash.
 

10 More Discussions You Might Find Interesting

1. Programming

read, write & STDOUT_FILENO....

hi guys, I'have a question 4 u. Why this code give me the right output (an integer on the stdout): read(fd,&mpid,sizeof(pid_t)); printf("%d\n",mpid); Instead this code give me only a blank line: read(fd,&mpid,sizeof(pid_t)); write(STDOUT_FILENO,&mpid,sizeof(pid_t)); ... (2 Replies)
Discussion started by: M3xican
2 Replies

2. UNIX for Dummies Questions & Answers

How do i access (mount, read & write) a floppy disk from the console, not being root?

welll, the title quite explains what i want to do thanks for your time! (4 Replies)
Discussion started by: kfaday
4 Replies

3. Shell Programming and Scripting

File read & execute problem

Hi folks, Need your help. I am writing a KSH script to read a few commands from a file & execute. I am using the following code to read the file line by line & excute each command. When I am printing each line I see it is printing properly but while excuting, the particular "ps" command... (5 Replies)
Discussion started by: tipsy
5 Replies

4. UNIX for Dummies Questions & Answers

user & group read/write access question

folks; I created a new users on my SUSE box and i need to give this user/group a read write access to one specific folder. here's the details: - I created new user "funny" under group "users". - I need to give this user "funny" a read/write access to another directory that is owned by "root".... (3 Replies)
Discussion started by: Katkota
3 Replies

5. UNIX for Dummies Questions & Answers

About read,write & execute permissons of a directory

Hi all, I want to know differences between read,write & execute permissons given to directory. Thanx in advance. (6 Replies)
Discussion started by: vishwasrao
6 Replies

6. Shell Programming and Scripting

Bash Script to Read & Write on different directories

Hi, root@server] df -h 121G 14G 101G 12% /home 147G 126G 14G 91% /backup We having our site files and images are storing in /backup/home/user/files/ through symbolic link created in /home directory pointing in /backup directory as following. root@server] cd /home... (1 Reply)
Discussion started by: mirfan
1 Replies

7. Shell Programming and Scripting

PHP read large string & split in multidimensional arrays & assign fieldnames & write into MYSQL

Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP. I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies

8. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

9. Programming

help: problem with sockets write/read

I am trying to make a server and client, the client will choose between some options and the server will react accordingly. After a some reads and writes that work the server needs to read from client an INT i use this: read(newSd,&k,sizeof(int));But even if all the other times there was no... (1 Reply)
Discussion started by: theSling
1 Replies

10. UNIX for Dummies Questions & Answers

MAN and read & write function

How to use MAN to find information about read() and write() function ? The command "man read" show some rubbish, for example "man open" show great information about function I need. (2 Replies)
Discussion started by: bbqtoss
2 Replies
IO::Async::Channel(3pm) 				User Contributed Perl Documentation				   IO::Async::Channel(3pm)

NAME
"IO::Async::Channel" - pass values into or out from an IO::Async::Routine DESCRIPTION
A "IO::Async::Channel" object allows Perl values to be passed into or out of an IO::Async::Routine. It is intended to be used primarily with a Routine object rather than independently. For more detail and examples on how to use this object see also the documentation for IO::Async::Routine. A Channel object is shared between the main process of the program and the process running within the Routine. In the main process it will be used in asynchronous mode, and in the Routine process it will be used in synchronous mode. In asynchronous mode all methods return immediately and use "IO::Async"-style callback functions. In synchronous within the Routine process the methods block until they are ready and may be used for flow-control within the routine. Alternatively, a Channel may be shared between two different Routine objects, and not used directly by the controlling program. The channel itself represents a FIFO of Perl reference values. New values may be put into the channel by the "send" method in either mode. Values may be retrieved from it by the "recv" method. Values inserted into the Channel are snapshot by the "send" method. Any changes to referred variables will not be observed by the other end of the Channel after the "send" method returns. Since the channel uses Storable to serialise values to write over the communication filehandle only reference values may be passed. To pass a single scalar value, "send" a SCALAR reference to it, and dereference the result of "recv". CONSTRUCTOR
$channel = IO::Async::Channel->new Returns a new "IO::Async::Channel" object. This object reference itself should be shared by both sides of a "fork()"ed process. After "fork()" the two "setup_*" methods may be used to configure the object for operation on either end. While this object does in fact inherit from IO::Async::Notifier for implementation reasons it is not intended that this object be used as a Notifier. It should not be added to a Loop object directly; event management will be handled by its containing "IO::Async::Routine" object. METHODS
$channel->configure( %params ) Similar to the standard "configure" method on "IO::Async::Notifier", this is used to change details of the Channel's operation. on_recv => CODE May only be set on an async mode channel. If present, will be invoked whenever a new value is received, rather than using the "recv" method. $on_recv->( $channel, $data ) on_eof => CODE May only be set on an async mode channel. If present, will be invoked when the channel gets closed by the peer. $on_eof->( $channel ) $channel->send( $data ) Pushes the data stored in the given Perl reference into the FIFO of the Channel, where it can be received by the other end. When called on a synchronous mode Channel this method may block if a "write()" call on the underlying filehandle blocks. When called on an asynchronous mode channel this method will not block. $channel->send_frozen( $record ) A variant of the "send" method; this method pushes the byte record given. This should be the result of a call to "Storable::freeze()". $data = $channel->recv When called on a synchronous mode Channel this method will block until a Perl reference value is available from the other end and then return it. If the Channel is closed this method will return "undef". Since only references may be passed and all Perl references are true the truth of the result of this method can be used to detect that the channel is still open and has not yet been closed. $channel->recv( %args ) When called on an asynchronous mode Channel this method appends a callback function to the receiver queue to handle the next Perl reference value that becomes available from the other end. Takes the following named arguments: on_recv => CODE Called when a new Perl reference value is available. Will be passed the Channel object and the reference data. $on_recv->( $channel, $data ) on_eof => CODE Called if the Channel was closed before a new value was ready. Will be passed the Channel object. $on_eof->( $channel ) $channel->close Closes the channel. Causes a pending "recv" on the other end to return undef or the queued "on_eof" callbacks to be invoked. AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.14.2 2012-10-24 IO::Async::Channel(3pm)
All times are GMT -4. The time now is 01:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy