LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-05-2008, 10:22 AM   #1
shifter
Member
 
Registered: May 2006
Distribution: Slackware, DragonFly
Posts: 233

Rep: Reputation: 30
problem with connect() and listen()


I 'd like to connect my client.c to my server.c, but the outout for my client is "Connection refused". The test is following:

#./client 192.168.23.101 6000
Errore: Connection refused
Return connect: -1 - Connection refused, Codice Errore: 111

#./server 6000
Return listen: 0, Error Code: 0
Success

I know that errno = ECONNREFUSED meaning:

Quote:
int listen (int socket, unsigned int n)

The listen function enables the socket socket to accept connections, thus making it a server socket.

The argument n specifies the length of the queue for pending connections. When the queue fills, new clients attempting to connect fail with ECONNREFUSED until the server calls accept to accept a connection from the queue.

The listen function returns 0 on success and -1 on failure.

Listen work, but queue is full, I try generating other executable, but problem remains. How can I solve this problem?
 
Old 08-05-2008, 01:11 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Do the iptables settings on the server allow connection? Do you try to connect using more clients at once than your listen parameter?
ta0kira

Last edited by ta0kira; 08-05-2008 at 01:15 PM.
 
Old 08-05-2008, 03:10 PM   #3
skoona
Member
 
Registered: Mar 2004
Location: Indiana, USA
Distribution: Fedora, CentOS, Ubuntu, OS/X, Raspbian
Posts: 90

Rep: Reputation: 18
Shifter,

Post the C code your using/writing so we can see the whole picture.

Also, the following may be helpful!

http://www.beej.us/guide/bgnet/outpu...l#simpleserver
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apache security for intranet: "listen 80" vs. "listen 127.0.0.1:80" pulper Linux - Software 3 09-27-2006 06:24 AM
Problem with BIND - Can't resolve hostnames unless listen-on is set to the IP range GD_19 Linux - Networking 2 07-07-2005 04:56 PM
Problem with XMMS: can't listen mp3 Lead Expression Linux - Software 1 01-25-2005 04:49 AM
Problem withInternet, DHCP, connect with eth0 down work, connect with eth0 up not zowey Linux - Networking 1 03-12-2004 10:05 AM
deam tftp listen problem saavik Linux - Networking 1 01-01-2003 11:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration