Sponsored Content
Top Forums Programming connect() function in C++ socket programming Post 302258916 by smdhd3 on Sunday 16th of November 2008 02:44:36 PM
Old 11-16-2008
connect() function in C++ socket programming

Hello All,

I have a problem using connect(...) function in C++. I am using SSH from my windows system to connect it to linux server. The program works fine if I run it directly in Linux machine but I need it to run through windows machine.
The function returns -1 and so my program terminates.

Can anyone help? or tell me how to show the exact error in unix C++ program because I am getting '1076041180' error number and I can't figure what is the exact problem.

Thanks...
 

10 More Discussions You Might Find Interesting

1. Programming

Socket Programming socket

Hello, I actually try to make client-server program. I'm using SCO OpenServer Release 5.0.0 and when I try to compile my code (by TELNET) I've got this error : I'm just using this simple code : and I get the same error if I use : If someone can help me, Thanks (2 Replies)
Discussion started by: soshell
2 Replies

2. Programming

Need Help Regarding Socket Programming

Can anyone plz me. I need a sample code for the following description. Its urgent. It is C/Socket program with the following descriptions: NAME coreadServer - Concurrent Readers Server. coreadClient - Concurrent Readers Client. SYNOPSIS coreadServer <OutputFile> coreadClient <n>... (1 Reply)
Discussion started by: priya.vmr
1 Replies

3. IP Networking

socket programming

Hello Everyone Iam working on tcp/ip programming.with some time interval server has to send data.client has to close the connection and to open the connection between the time interval.this is the scenario when iam closing the connection in client side the connection terminates.how to... (1 Reply)
Discussion started by: sureshvaikuntam
1 Replies

4. Programming

Please help! accept function problems in Socket programming

Hi, I have a client-server socket program. It has been working fine for over a year, but recently it started to show strange behavior.:confused: After the server program runs for a while, it will show in the top command saying it is using lots of CPU, MEM. I assume it means the server code is... (1 Reply)
Discussion started by: natxie
1 Replies

5. UNIX for Advanced & Expert Users

connect problem for sctp socket (ipv6 socket) - Runtime fail Invalid Arguments

Hi, I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime. To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies

6. Programming

connect() socket API

Is there any relation between the connect() socket API and the TCP's Transmission Control Block. Also how does connect detect that a socket is in use i.e., EADDRINUSE (1 Reply)
Discussion started by: sunaina
1 Replies

7. Programming

socket function to read a webpage (socket.h)

Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct... #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include... (3 Replies)
Discussion started by: cyler
3 Replies

8. Programming

Socket programming

Hi everyone, I'm new to this forum. I'm working on new project for last few days and this forum already helped me on couple of occasions. I don't have any prior experience with network programming so I'll appreciate any advise given. I'm trying to do the following: 1. open user... (2 Replies)
Discussion started by: _thomas
2 Replies

9. Programming

socket programming

how to include socket.h in visual studio 2005.. (2 Replies)
Discussion started by: asd123
2 Replies

10. UNIX for Dummies Questions & Answers

Cannot connect to socket

solaris client report "cannot to socket(code 25)" while trying to backup on veritas netbackup 6.5.5 server (1 Reply)
Discussion started by: EUGINIAM
1 Replies
connect(3SOCKET)														  connect(3SOCKET)

NAME
connect - initiate a connection on a socket SYNOPSIS
cc [ flag ... ] file ... -lsocket -lnsl [ library ... ] #include <sys/types.h> #include <sys/socket.h> int connect(int s, const struct sockaddr *name, int namelen); The parameter s is a socket. If it is of type SOCK_DGRAM, connect() specifies the peer with which the socket is to be associated. This address is the address to which datagrams are to be sent if a receiver is not explicitly designated. This address is the only address from which datagrams are to be received. If the socket s is of type SOCK_STREAM, connect() attempts to make a connection to another socket. The other socket is specified by name. name is an address in the communication space of the socket. Each communication space interprets the name parameter in its own way. If s is not bound, then s will be bound to an address selected by the underlying transport provider. Gener- ally, stream sockets can successfully connect() only once. Datagram sockets can use connect() multiple times to change their association. Datagram sockets can dissolve the association by connecting to a null address. If the connection or binding succeeds, 0 is returned. Otherwise, -1 is returned and sets errno to indicate the error. The call fails if: EACCES Search permission is denied for a component of the path prefix of the pathname in name. EADDRINUSE The address is already in use. EADDRNOTAVAIL The specified address is not available on the remote machine. EAFNOSUPPORT Addresses in the specified address family cannot be used with this socket. EALREADY The socket is non-blocking, and a previous connection attempt has not yet been completed. EBADF s is not a valid descriptor. ECONNREFUSED The attempt to connect was forcefully rejected. The calling program should close(2) the socket descriptor, and issue another socket(3SOCKET) call to obtain a new descriptor before attempting another connect() call. EINPROGRESS The socket is non-blocking, and the connection cannot be completed immediately. You can use select(3C) to com- plete the connection by selecting the socket for writing. EINTR The connection attempt was interrupted before any data arrived by the delivery of a signal. The connection, how- ever, will be established asynchronously. EINVAL namelen is not the size of a valid address for the specified address family. EIO An I/O error occurred while reading from or writing to the file system. EISCONN The socket is already connected. ELOOP Too many symbolic links were encountered in translating the pathname in name. ENETUNREACH The network is not reachable from this host. EHOSTUNREACH The remote host is not reachable from this host. ENOENT A component of the path prefix of the pathname in name does not exist. ENOENT The socket referred to by the pathname in name does not exist. ENOSR There were insufficient STREAMS resources available to complete the operation. ENXIO The server exited before the connection was complete. ETIMEDOUT Connection establishment timed out without establishing a connection. EWOULDBLOCK The socket is marked as non-blocking, and the requested operation would block. The following errors are specific to connecting names in the UNIX domain. These errors might not apply in future versions of the UNIX IPC domain. ENOTDIR A component of the path prefix of the pathname in name is not a directory. ENOTSOCK s is not a socket. ENOTSOCK name is not a socket. EPROTOTYPE The file that is referred to by name is a socket of a type other than type s. For example, s is a SOCK_DGRAM socket, while name refers to a SOCK_STREAM socket. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ close(2), accept(3SOCKET), getsockname(3SOCKET), select(3C), socket(3SOCKET), socket.h(3HEAD), attributes(5) 08 Mar 2005 connect(3SOCKET)
All times are GMT -4. The time now is 07:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy