![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| IP Networking Questions involving TCP/IP, Routers, Hubs, Network protocols, etc go here. |
|
|
||||
| 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 08:25 AM |
| Connection refused to ftp from a unix server to a windows pc | alexcol | Shell Programming and Scripting | 1 | 06-21-2007 09:35 AM |
| rsh problem connection refused | Mace | Shell Programming and Scripting | 4 | 06-12-2006 07:28 PM |
| telnet connection refused | printrick | SCO | 2 | 01-11-2006 12:38 PM |
| Connection refused from pop server | bluehell | IP Networking | 2 | 06-20-2003 07:03 AM |
|
|
LinkBack | Thread Tools | 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! |
| Forum Sponsor | ||
|
|
|
|||
|
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 |
|||
| Google UNIX.COM |