And now, what is the problem. When "connect" is executed for the first time (return code = 150), "getsockopt" in "error_s" return code "146", but after "goto"
when "getsockopt" is executed second time "error_s" is equal "0" (which means connection is established successfully).
Example output:
The same code executed on i.e. Linux CentOS or HPUX, when getsockopt is executed second time, return error codes and inform that there is no connection but in case of Solaris
"getsockopt" works in a strange way.
Please explain what is the problem or how to deal with such behavior on Solaris.
Thanks in advance.
Last edited by revolta25; 01-19-2015 at 03:12 AM..
Hi there,
I have a strange problem and I cannot figure it out what I am doing wrong here.
Let me try to picture it.
In principle it is prety straight forward, but something odd is happening.
Here is part of the input file snmp_alm.cfg:
... (2 Replies)
Hello everyone.
I beg your guys pardon please.
I try to ls -al in many path/directories. So, I put the code in text file which look like below;
ls -al /
ls -al /etc
ls -al /etc/default
...
however, when I paste it to Solaris over SecureCRT, it seems the code was escaped from "-" to... (0 Replies)
Is it normal behavior for a shell script that terminates to terminate its parent shell when executed with the "." option?
For example, if I have the example script (we'll name it ex.sh):
#!/bin/sh
if
then
echo "Bye."
exit 2
fi
And I execute it like this:
>./ex.sh
It... (6 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
I've posted about this before, but only recently narrowed the problem down to a specific cause.
Ok, first of all, the behavior:
It occurs when autocompletion brings up its list (not when there is only a single option). Basically, if I were to type, say,
cd ~/<TAB>
I would get something... (2 Replies)
This really puzzles me. The following code gives me the error 'expr: syntax error' when I try to do multi-line comment using here document
<<EOF
echo "Sum is: `expr $1 + $2`"
EOF
Even if I explicitly comment out the line containing the expr using "#", the error message would still exist... (3 Replies)
Hi there,
I'm running into a very weird situation. Let's forget about the purpose of my initial script please. I noticed the bug whatever I'm trying to do.
I'm on an old server running bash 3.1.17.
Say we have the following script :
foo:~# cat /tmp/test
#!/bin/bash
f1() {
local... (9 Replies)
Look at the following data file(cou.data) which has four fields separated by tab.
Four fields are country name, land area, population, continent where it belongs.
As for country name or continent name which has two words, two words are separated by space.
(Data are not accurately... (1 Reply)
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
LEARN ABOUT NETBSD
connect
CONNECT(2) BSD System Calls Manual CONNECT(2)NAME
connect -- initiate a connection on a socket
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <sys/socket.h>
int
connect(int s, const struct sockaddr *name, socklen_t namelen);
DESCRIPTION
The parameter s is a socket. If it is of type SOCK_DGRAM, this call specifies the peer with which the socket is to be associated; this
address is that to which datagrams are to be sent, and the only address from which datagrams are to be received. If the socket is of type
SOCK_STREAM, this call attempts to make a connection to another socket. The other socket is specified by name, which is an address in the
communications space of the socket. namelen indicates the amount of space pointed to by name, in bytes. Each communications space inter-
prets the name parameter in its own way. Generally, stream sockets may successfully connect() only once; datagram sockets may use connect()
multiple times to change their association. Datagram sockets may dissolve the association by connecting to an invalid address, such as a
null address.
If a connect() call is interrupted by a signal, it will return with errno set to EINTR and the connection attempt will proceed as if the
socket was non-blocking. Subsequent calls to connect() will set errno to EALREADY.
RETURN VALUES
If the connection or binding succeeds, 0 is returned. Otherwise a -1 is returned, and a more specific error code is stored in errno.
ERRORS
The connect() call fails if:
[EBADF] s is not a valid descriptor.
[ENOTSOCK] s is a descriptor for a file, not a socket.
[EADDRNOTAVAIL] The specified address is not available on this machine.
[EAFNOSUPPORT] Addresses in the specified address family cannot be used with this socket.
[EISCONN] The socket is already connected.
[ETIMEDOUT] Connection establishment timed out without establishing a connection.
[ECONNREFUSED] The attempt to connect was forcefully rejected.
[ENETUNREACH] The network isn't reachable from this host.
[EADDRINUSE] The address is already in use.
[EFAULT] The name parameter specifies an area outside the process address space.
[EINPROGRESS] The socket is non-blocking and the connection cannot be completed immediately. It is possible to select(2) or poll(2) for
completion by selecting or polling the socket for writing. The success or failure of the connect operation may be deter-
mined by using getsockopt(2) to read the socket error status with the SO_ERROR option at the SOL_SOCKET level. The
returned socket error status is zero on success, or one of the error codes listed here on failure.
[EALREADY] Either the socket is non-blocking mode or a previous call to connect() was interrupted by a signal, and the connection
attempt has not yet been completed.
[EINTR] The connection attempt was interrupted by a signal.
The following errors are specific to connecting names in the UNIX domain. These errors may not apply in future versions of the UNIX IPC
domain.
[ENOTDIR] A component of the path prefix is not a directory.
[ENAMETOOLONG] A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters.
[ENOENT] The named socket does not exist.
[EACCES] Search permission is denied for a component of the path prefix, or write access to the named socket is denied.
[ELOOP] Too many symbolic links were encountered in translating the pathname.
SEE ALSO accept(2), getsockname(2), getsockopt(2), poll(2), select(2), socket(2)HISTORY
The connect() function call appeared in 4.2BSD.
BSD May 18, 2004 BSD