Sponsored Content
Full Discussion: read function
Top Forums UNIX for Dummies Questions & Answers read function Post 19562 by rwb1959 on Friday 12th of April 2002 04:55:47 PM
Old 04-12-2002
It would be better if we could see your code (excerpts) that
setup and do the message exchange. There are some operations
in which you must interleave reads and writes but if you wrote
some sort of socket (UNIX or INET) communications, this should
not be an issue. If you can't post code excerpts, try to give
as much detail about what you are doing and how you are doing
it. Maybe someone can help.
 

10 More Discussions You Might Find Interesting

1. Programming

read a file wich fscanf() in a function

I use fopen, fscanf, fclose to read a file. It can work well. since many files should be read, a function is created with the same code. But in the function, fscanf can not work well. for example, the first line of the the file is: > filename but the fscanf will give: 207/23/eee/34 it appears... (2 Replies)
Discussion started by: cdbug
2 Replies

2. Programming

Cannot read a file with read(fd, buffer, buffersize) function

# include <stdio.h> # include <fcntl.h> # include <stdlib.h> # include <sys/stat.h> int main(int argc, char *argv) { int fRead, fPadded, padVal; int btRead; int BUFFSIZE = 512; char buff; if (argc != 4) { printf ("Please provide all of the... (3 Replies)
Discussion started by: naranja18she
3 Replies

3. Shell Programming and Scripting

read statement not working in a function

Pls this is emergency.I have written a script which is taking input from another script. and the contents of my second script are acting as functions to my main script.Now the problem is that in one of the functions i want the script ececution to stop and start when user enters any character r... (2 Replies)
Discussion started by: sumitdua
2 Replies

4. UNIX for Dummies Questions & Answers

Can we read in variable into function in Unix?

can u read variables into function in unix like java or c++ eg sum($1) { if echo "$1 is equal to yes" else echo "$1 not equal to yes" } and if so what r the rulz to using function in unix for using functions thanks in advance :confused: (1 Reply)
Discussion started by: ShinTec
1 Replies

5. UNIX for Dummies Questions & Answers

Can you read in variable into function in Unix?

can you read variables into function in unix like java or c++ eg sum($1) { if echo "$1 is equal to yes" else echo "$1 not equal to yes" } and if so what are the rules to reading variables into function in unix thanks in advance for your answer (2 Replies)
Discussion started by: ShinTec
2 Replies

6. Shell Programming and Scripting

Help with grep and read function in a BASH Script

I'm putting together a script that will search my mail archives for emails that meet certain criteria and output the files to a text file. I can manually cat that text file and pipe it into sendmail and it will work (i.e. cat /pathtofile/foo.txt | sendmail -t me@company.com) My script sends... (7 Replies)
Discussion started by: binary-ninja
7 Replies

7. Shell Programming and Scripting

bash read within function with arguments

I have trouble getting this logic to work #!/bin/bash function assign_var(){ while do read -p "$2 :" $3 done } assign_var '$IPADDRESS' ipaddress IPADDRESS Basicly, i want to make sure that entry is made (i can add more sophisticated checks later), but the idea is to recycle... (11 Replies)
Discussion started by: serverchief
11 Replies

8. UNIX Desktop Questions & Answers

AIX how to read the file in function again and again

dear friends I have a wrote a shell script which works like this. 1.) a command is executed and the log is moved in the file. 2.) this file is copied in to the other file. 3.) used a grep command to find a particular word. 4.) if a particular word is there then the script will go to next... (4 Replies)
Discussion started by: aboy212u
4 Replies

9. Shell Programming and Scripting

[Bash] Read History function & Read Arrowkeys

Hi. How can I create a history function? (By "read" command or so) & How can I configure a read command so that the arrow keys are not displayed so funny? (^[[A) Thanks in advance. (4 Replies)
Discussion started by: sinnlosername
4 Replies

10. Shell Programming and Scripting

While read won't run keyboard function

I am using while read do/ done to retrieve menu item. Works as advertised, no problem. I am using this hack function "pause" to stop script execution and wait for keyboard "enter" key to continue. Sort of break point function. Also works fine with one exception - it does not work when used... (4 Replies)
Discussion started by: annacreek
4 Replies
socket(2)							System Calls Manual							 socket(2)

NAME
socket - Creates an end point for communication and returns a descriptor SYNOPSIS
#include <sys/socket.h> int socket ( int domain, int type, int protocol ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: socket(): XNS5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the communications domain in which a socket is to be created. The domain argument specifies the address family with which addresses specified in later socket operations should be interpreted. The sys/socket.h file contains the definitions of the address fami- lies. Commonly used families are: UNIX pathnames Internet addresses (IPv4) [Tru64 UNIX] Internet addresses (IPv6) Specifies the seman- tics of communication. The sys/socket.h file defines the socket types. The following types are supported: Provides sequenced, reliable, two-way byte streams with a transmission mechanism for out-of-band data. Provides datagrams, which are connectionless messages of a fixed maximum length. [Tru64 UNIX] Provides access to internal network protocols and interfaces. This type of socket is available only to a process with superuser privilege. Specifies a particular protocol to be used with the socket. Specifying a protocol of 0 (zero) causes the socket() function to default to the typical protocol for the requested type of returned socket. DESCRIPTION
The socket() function creates a socket of the specified type in the specified domain. The socket() function returns a descriptor (an integer) that can be used in later system calls that operate on sockets. Socket level options control socket operations. The getsockopt() and setsockopt() functions are used to get and set these options, which are defined in the sys/socket.h file. RETURN VALUES
Upon successful completion, the socket() function returns a nonnegative integer (the socket descriptor). Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
If the socket() function fails, errno may be set to one of the following values: The process have not have appropriate privileges. The addresses in the specified address family are not available in the kernel. The per-process descriptor table is full. No more file descriptors are available for the system. Insufficient resources were available in the system to complete the call. The system was unable to allocate kernel memory to increase the process descriptor table. The available STREAMS resources were insufficient for the operation to complete. [Tru64 UNIX] The process is attempting to open a raw socket and does not have superuser privilege. The socket in the specified address family is not supported. The socket type is not supported by the protocol. RELATED INFORMATION
Functions: accept(2), bind(2), connect(2), listen(2), getsockname(2), getsockopt(2), recv(2), recvfrom(2), recvmsg(2), send(2), sendto(2), sendmsg(2), setsockopt(2), shutdown(2), socketpair(2) Standards: standards(5) delim off socket(2)
All times are GMT -4. The time now is 01:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy