LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 02: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, 03:38 AM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
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 03:42 AM.
 
Old 11-15-2009, 04:47 AM   #3
hiteshshahk
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Blog Entries: 1

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 05:01 PM.
 
Old 11-15-2009, 09:35 AM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

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, 02:17 PM   #5
hiteshshahk
LQ Newbie
 
Registered: Nov 2009
Posts: 3

Original Poster
Blog Entries: 1

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-15-2009, 11:10 PM   #6
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

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-15-2009 at 11:11 PM.
 
  


Reply

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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:01 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