LinuxQuestions.org
Social Bookmarking all things Linux and Open Source
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This 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

Tags used in this thread
Popular LQ Tags , , , , , , , , ,

Reply
 
Thread Tools
Old 11-15-2009, 03:39 AM   #1
hiteshshahk
LQ Newbie
 
Registered: Nov 2009
Posts: 3
Blog Entries: 1
Thanked: 0
Connect function in client returns minus 1


[Log in to get rid of this advertisement]
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.
linuxubuntu hiteshshahk is offline     Reply With Quote
Old 11-15-2009, 04:38 AM   #2
r3sistance
Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 648
Thanked: 37
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..
windows_vista r3sistance is offline     Reply With Quote


Old 11-15-2009, 05:47 AM   #3
hiteshshahk
LQ Newbie
 
Registered: Nov 2009
Posts: 3
Blog Entries: 1
Thanked: 0

Original Poster
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..
windows_xp_2003 hiteshshahk is offline     Reply With Quote


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 8.04 (upgraded from 6.06), Ubuntu Netbook Remix 9.04
Posts: 2,742
Thanked: 87
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.
linuxubuntu Wim Sturkenboom is offline  
Tag This Post , , , , , , , , ,
Reply With Quote


Old 11-15-2009, 03:17 PM   #5
hiteshshahk
LQ Newbie
 
Registered: Nov 2009
Posts: 3
Blog Entries: 1
Thanked: 0

Original Poster
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?
linuxubuntu hiteshshahk is offline  
Tag This Post
Reply With Quote


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 8.04 (upgraded from 6.06), Ubuntu Netbook Remix 9.04
Posts: 2,742
Thanked: 87
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..
windows_xp_2003 Wim Sturkenboom is offline     Reply With Quote



Reply

Bookmarks


Thread Tools

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-10-2009 10:44 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 03:38 AM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration