The send buffer is an address to memory of any type. send() doesn't really care whether you feed it a pointer to a string or an integer or structure or anything else, memory's memory as far as it's concerned. It just dumps it to the socket raw. Which means you need to order it the way your receiver expects yourself before you call send() at all.
Are you trying to send ASCII text, or binary data? If you want to send it as ASCII text, you'll need to convert it:
If you want to send it as raw binary, that's simple too:
Last edited by Corona688; 05-07-2010 at 05:27 PM..
Reason: typo
How can 'popen()' be used for reading and writing to opening pipe?
If i try 'popen("prog", "rw")'
and then put and get chars - it does
not work.
What is wrong? (1 Reply)
I am trying to write a script that will do a sql statement. But in the sql I will have a list (1,2,3,4).
How would I go about asking for the input from the user running the script, and then transferring that back into the list as say ($var1,$var2,$var3)?
It would be somewhat like this:
... (1 Reply)
I need to find all the files that have group Read or Write permission or files that have user write permission.
This is what I have so far:
find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}'
It shows me all files where group read = true, group write = true... (5 Replies)
Hi all,
I have a problem with some read/write functions.
I have a .bin file which contains a lot of structures as follows:
struct alumno
{
char id;
char apellido1;
char apellido2;
char nombre;
float nota1p;
float nota2p;
float notamedia;
char photofilename;
};
What I have... (3 Replies)
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)
HI
I need to implement a client/server TCP application. the customer is the client and the bartender is the server.
When the customer enter the Bar, client connects to the server
Server should reply the client immediately. Other wise if the server is busy, it should send an update message... (10 Replies)
EDIT: Nevermind. I found a forth kludge to get around the psed requirement!
Short version: I'm trying to use the "w" flag with psed to write all substituted lines into another file. No matter how many times I read the man pages or search with Google, I can't seem to find the proper syntax... (0 Replies)
Hi Everyone,
newbie here, please help me i can't read the code i'm confused reading this code.
select c.net_svc_id, c.inst_st_dt into ${REO_RECON_USERID_LUZON_TEMP} from ${WO_INST_SITE_COMP_FIELDS} a, ${WO_INST_SITE_COMPONENTS} b, ${WO_INST} c where a.cust_ac_no = b.cust_ac_no and... (3 Replies)
I have got a file in following format:
AAAAAAA
BBBBBBBB
CCCCCCC
DDDDDDD
I am trying to read this file and out put it in following format:
AAAAAAA,BBBBBBB,CCCCCCC,DDDDDD
Preferred method is shell or Perl.
Any help appreciated. (11 Replies)
Can someone help me to write this program in C in QNX?
Using the FIFO queues write a simple communication system consisting of programs write and read. The program write the parameters given strings enclosed in single quotes. These strings are written to the FIFO file. Reads the program read... (1 Reply)
Discussion started by: ebasse2
1 Replies
LEARN ABOUT ULTRIX
sendto
send(2) System Calls Manual send(2)Name
send, sendto, sendmsg - send a message from a socket
Syntax
#include <sys/types.h>
#include <sys/socket.h>
cc = send(s, msg, len, flags)
int cc, s;
char *msg;
int len, flags;
cc = sendto(s, msg, len, flags, to, tolen)
int cc, s;
char *msg;
int len, flags;
struct sockaddr *to;
int tolen;
cc = sendmsg(s, msg, flags)
int cc, s;
struct msghdr msg[];
int flags;
Description
The and system calls are used to transmit a message to another socket. The system call may be used only when the socket is in a connected
state, while the and system calls may be used at any time.
The address of the target is given by to, with tolen specifying its size. The length of the message is given by len. If the message is
too long to pass atomically through the underlying protocol, the error EMSGSIZE is returned, and the message is not transmitted. If the
address specified in the argument is a broadcast address, the SO_BROADCAST option must be set for broadcasting to succeed.
No indication of failure to deliver is implicit in a Return values of -1 indicate some locally detected errors.
If no messages space is available at the socket to hold the message to be transmitted, normally blocks, unless the socket has been placed
in nonblocking I/O mode. The call can be used to determine when it is possible to send more data.
The flags parameter can be set to MSG_OOB to send out-of-band data on sockets that support this features (for example, SOCK_STREAM).
See for a description of the msghdr structure.
The call returns the number of characters sent, or -1 if an error occurred.
Diagnostics
[EBADF] An invalid descriptor was specified.
[EDESTADDRREQ] A required address was omitted from an operation on a socket.
[EFAULT] An invalid user space address was specified for a parameter.
[EINVAL] An invalid argument length for the message was specified.
[EINTR] The send was interrupted by delivery of a signal.
[ENOTCONN] The socket is not connected.
[ENOTSOCK] The argument s is not a socket.
[EMSGSIZE] The socket requires that messages be sent atomically, and the size of the message to be sent made this impossible.
[EPIPE] A write on a pipe or socket for which there is no process to read the data.
[EWOULDBLOCK] The socket is marked nonblocking, and the requested operation would block.
See Alsorecv(2), getsockopt(2), socket(2)send(2)