![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Send email with attachement-Getting connection refused by domain | samuelc | UNIX for Dummies Questions & Answers | 1 | 02-08-2008 12:25 PM |
| Connection refused to ftp from a unix server to a windows pc | alexcol | Shell Programming and Scripting | 1 | 06-21-2007 01:35 PM |
| rsh problem connection refused | Mace | Shell Programming and Scripting | 4 | 06-12-2006 11:28 PM |
| telnet connection refused | printrick | SCO | 2 | 01-11-2006 04:38 PM |
| Connection refused from pop server | bluehell | IP Networking | 2 | 06-20-2003 11:03 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Connection refused
Hi there,
Anything will help. I have running server on computer and want to connect from some clients. Server: memset(&hints, 0, sizeof(hints)); hints.ai_family = domain; hints.ai_socktype = SOCK_STREAM; error = getaddrinfo("localhost", "8300", &hints, &res0); if (error) { return false; } for (res = res0; res; res = res->ai_next) { socket_d = socket(res->ai_family, res->ai_socktype, res->ai_protocol); int result = bind(socket_desc, (const sockaddr *) res->ai_addr, res->ai_addrlen); } And I want to connect from some client: memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNKNOWN; hints.ai_socktype = SOCK_STREAM; error = getaddrinfo("195.113.21.133", "8300", &hints, &res0); if (error) { return false; } for (res = res0; res; res = res->ai_next) { socket_d = socket(res->ai_family, res->ai_socktype, res->ai_protocol); int result = connect(socket_d, res->ai_addr, res->ai_addrlen); } When I put "localhost" in getaddrinfo everything is fine. But when I tried to put some other IP, it crashes. IP is correct, both computers are on same network. THX for any advice! |
|
||||
|
Hello,
The socket() call should be made on the localhost, which means that you wnat to create a socket on the localmachine In the connect() call, mention the address of the server which you want to connect. and on the server side, after socket and bind, listen and accept functions should be called for listening and accepting socket from the client. Regards Gaurav |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|