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 every 10 seconds.
Depending on which message replied by the server:
10 seconds expired, no reply: client leave, that is disconnect
server is busy update: client reply --waiting or "leave and disconnect"
select beer: client reply -- light or black
select quantity: client reply liter or bottle, then disconnect
I have done the part before 'connection', but i don't know how to complement the function about read() and write(), so, please help me have a look at it, many thanks!!
I need to add a function of 'timeout' on read(),but i don't know how to do that.
thus how can i add a circle to implement many customers entering?
Last edited by lixiao1212; 11-07-2010 at 03:20 PM..
Reason: Please use code tags
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 have tried to show the file name whose size is greater than 200 byte in current directory.
Please help me.
ls -l | tr -s " " " " | cut -f 5,9 -d " " >out.txt
#set -a x `cat out.txt`
i=0
`cat out.txt` | while
do
read x
echo $x
#re=200
j=0
if }" < "200" ]
then
echo $j
j=`expr $j... (2 Replies)
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
am newbie to unix and socket programing
I am trying to figuring out syntax for read and write
to send data from server to client and client can read it
I have to send two integers
write(newsockfd,buffer,"%d %d",x,y,0) writing from client where x and y are two integers..
... (7 Replies)
Hello all,
I have a requirement to read and write to a tcp socket from an HP-UX shell script. I see a /dev/tcp character device on my servers:
crw-rw-rw- 1 root root 72 0x00004f Mar 28 18:37 /dev/tcp
So I believe this is what I should use. The problem is that all the... (2 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)
Hello Guys, How all are doing?
I have an issue in Unix and want help from all of you
I have a file in UNIX which it read by line by line , If at the end of line '0' is written the it should fetch that line into another file and change '0' to '1'
and If at the end of line '1' is written then it... (10 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 LINUX
ic_c_protocol
ic_c_protocol(3erl) C Library Functions ic_c_protocol(3erl)NAME
ic_c_protocol - IC C Protocol Functions
DESCRIPTION
This manual page lists some of the functions of the IC C runtime library that are used internally for the IC protocol.
The listed functions are used internally by generated C client and server code. They are documented here for the advanced user that want to
replace the default protocol (Erlang distribution + gen_server) by his own protocol, For each set of client or sever functions below with
prefix oe , the user has to implement his own set of functions, the names of which are obtained by replacing the oe prefix by Prefix . The
Prefix has to be set with the option {user_protocol, Prefix} at compile time.
The following terminology is used (reflected in names of functions): a notification is a message send from client to server, without any
reply back (i.e. a oneway operation); a request is a message sent from client to server, and where a reply message is sent back from the
server to the client.
In order to understand how the functions work and what they do the user must study their implementation in the IC C library (source file is
ic.c ), and also consider how they are used in the C code of ordinary generated client stubs or server skeletons.
CLIENT PROTOCOL FUNCTIONS
The following functions are used internally by generated C client code.
EXPORTS
int oe_prepare_notification_encoding(CORBA_Environment *env)
The result of this function is the beginning of a binary of in external format of the tuple {'$gen_cast', X} where X is not yet
filled in.
In generated client code this function is the first to be called in the encoding function for each oneway operation.
int oe_send_notification(CORBA_Environment *env)
int oe_send_notification_tmo(CORBA_Environment *env, unsigned int send_ms)
Sends a client notification to a server according to the Erlang distribution + gen_server protocol.
The send_ms parameter specified a timeout in milliseconds.
int oe_prepare_request_encoding(CORBA_Environment *env)
The result of this function is the beginning of a binary in the external format of the tuple {'$gen_call', {Pid, Ref}, X} where X is
not yet filled in.
In generated client code this function is the first to be called in the encoding function for each twoway operation.
int oe_send_request_and_receive_reply(CORBA_Environment *env)
int oe_send_request_and_receive_reply_tmo(CORBA_Environment *env, unsigned int send_ms, unsigned int recv_ms)
Sends a client request and receives the reply according to the Erlang distribution + gen_server protocol. This function calls the
oe_prepare_reply_decoding function in order to obtain the gen_server reply.
send_ms and recv_ms specify timeouts for send and receive, respectively, in milliseconds.
int oe_prepare_reply_decoding(CORBA_Environment *env)
Decodes the binary version of the tuple {Ref, X} , where X is to be decoded later by the specific client decoding function.
SERVER PROTOCOL FUNCTIONS
The following functions are used internally by generated C server code.
EXPORTS
int oe_prepare_request_decoding(CORBA_Environment *env)
Decodes the binary version of the tuple {'$gen_cast', Op} ( Op an atom), or the tuple {'$gen_cast', {Op, X}} , where Op is the oper-
ation name, and where X is to be decoded later by the specific operation decoding function; or
decodes the binary version of the tuple {'$gen_call', {Pid, Ref}, Op} ( Op an atom), or the tuple {'$gen_call', {Pid, Ref}, {Op, X}}
, where Op> is the operation name, and X is to be decode later by the specific operation decoding function.
int oe_prepare_reply_encoding(CORBA_Environment *env)
Encodes the beginning of the binary version of the tuple {{Ref,X} , where X is to be filled in by the specific server encoding func-
tion.
SEE ALSO ic(3erl), ic_clib(3erl), IC Protocol
Ericsson AB ic 4.2.26 ic_c_protocol(3erl)