fetch.c (37571) | fetch.c (37573) |
---|---|
1/*- 2 * Copyright (c) 1998 Dag-Erling Co�dan Sm�rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 199 unchanged lines hidden (view full) --- 208 209 /* set up socket address structure */ 210 bzero(&sin, sizeof(sin)); 211 bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length); 212 sin.sin_family = he->h_addrtype; 213 sin.sin_port = htons(port); 214 215 /* try to connect */ | 1/*- 2 * Copyright (c) 1998 Dag-Erling Co�dan Sm�rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 199 unchanged lines hidden (view full) --- 208 209 /* set up socket address structure */ 210 bzero(&sin, sizeof(sin)); 211 bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length); 212 sin.sin_family = he->h_addrtype; 213 sin.sin_port = htons(port); 214 215 /* try to connect */ |
216 if ((sd = socket(sin.sin_family, SOCK_STREAM, 0)) < 0) | 216 if ((sd = socket(sin.sin_family, SOCK_STREAM, IPPROTO_TCP)) < 0) |
217 return -1; 218 if (connect(sd, (struct sockaddr *)&sin, sizeof sin) < 0) { 219 close(sd); 220 return -1; 221 } 222 223 return sd; 224} | 217 return -1; 218 if (connect(sd, (struct sockaddr *)&sin, sizeof sin) < 0) { 219 close(sd); 220 return -1; 221 } 222 223 return sd; 224} |