LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-15-2009, 03:39 AM   #1
hiteshshahk
LQ Newbie
 
Registered: Nov 2009
Posts: 3
Blog Entries: 1

Rep: Reputation: 0
Connect function in client returns minus 1


I am running server on one machine and client on another machine, when I execute the code then it shows "connect retuned rc= -1". With the same code when I runc client and server on same machine then it does not give wny problem.

Please address this problem as soon as possible.
 
Old 11-15-2009, 04:38 AM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
Quote:
Originally Posted by hiteshshahk View Post
Please address this problem as soon as possible.
Now that you said that... No... I think I'll waste my time else where thank you very much. All help here is volunteed, so don't tell us to address this problem as soon as possible, because it's not a problem that effects us.

P.S. you haven't actually said what your using, what scripts or whatever your using. You have given us no real information what so ever so what you think we can do to fix this for you, I have no frigging idea. In future be more careful with what you say and think about what we actually need to know to help you out.

Last edited by r3sistance; 11-15-2009 at 04:42 AM.
 
Old 11-15-2009, 05:47 AM   #3
hiteshshahk
LQ Newbie
 
Registered: Nov 2009
Posts: 3
Blog Entries: 1

Original Poster
Rep: Reputation: 0
I am actually using Ubuntu to run the Linux client-server program.
I tried giving 192.168.1.144 as an IP telnet address to the client but it is still not getting connected.

Do you want me to put the code client server code here?

how to use perror instead of errno?

Last edited by hiteshshahk; 11-15-2009 at 06:01 PM.
 
Old 11-15-2009, 10:35 AM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
It's a while ago that I did socket programming but if you check things like errno and use perror, you might be able to fine something.

As it's the client that does not connect, try telnet ipaddress portno or telnet hostname portno to connect to the server and see what works.

Check name resolution and firewalls.
 
Old 11-15-2009, 03:17 PM   #5
hiteshshahk
LQ Newbie
 
Registered: Nov 2009
Posts: 3
Blog Entries: 1

Original Poster
Rep: Reputation: 0
I tried giving 192.168.1.144 as an IP telnet address to the client but it is still not getting connected.

Do you want me to put the code client server code here?
 
Old 11-16-2009, 12:10 AM   #6
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
OK, by specifying the ip-adderss we can rule out dns issues.

No need to post your code, it will be more or less OK as it works on a local machine.

Assuming your server is listening on port 5678, you should use telnet 192.168.1.144 5678. I guess that this (exact) command works on the server itself and does not work when used on a remote machine. Please post the error message that telnet gives.

I don't think that this is a code issue; check your firewall settings.

And you should modify your client code so it will give more detailed information (as said earlier by using errno, perror and similar functions) just like telnet does.

Last edited by Wim Sturkenboom; 11-16-2009 at 12:11 AM.
 
  


Reply

Tags
as, connected, errno, how, instead, ip, still, telnet, tried


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
mmap function returns 0 instead of the address location btklee Linux - Kernel 0 01-09-2009 02:16 PM
c++ function that returns the user ID Hard_Working_ Programming 5 04-06-2007 07:26 PM
XP Client Returns 'Access is Denied' Error When Trying to Connect to a Samba Server BuckRogers01 Linux - Networking 1 05-25-2005 12:55 PM
C function that returns $HOME cbranje Programming 1 02-12-2005 06:41 PM
open function returns error sudheernair Programming 2 05-07-2004 12:14 PM


All times are GMT -5. The time now is 04:45 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration