creating socket()


 
Thread Tools Search this Thread
Top Forums Programming creating socket()
# 1  
Old 06-08-2010
creating socket()

deleted

Last edited by satish@123; 07-10-2010 at 02:45 PM..
# 2  
Old 06-08-2010
Are you talking about connect() or listen()? socket() does not connect to another computer it just creates the file descriptor (socket). Please post your code.
# 3  
Old 06-08-2010
It was connect() time out
# 4  
Old 06-08-2010
Set the socket to non-blocking with fcntl. Set up an FD_SET for the socket, call select() with whatever timeout you like. Reset the socket to non-blocking if you wish, after connect suceeds.
# 5  
Old 06-10-2010
Any reasonable wait time that we should wait for socket connection. I am waiting for 2 secs three tries and if still not connected closing the socket and saying machine not reachable.

Last edited by satish@123; 07-10-2010 at 02:48 PM.. Reason: deleting code
# 6  
Old 06-10-2010
Reasonable time is what you think is reasonable. TCP can still operate over pretty slow, high-latency, and lossy connections which is why its timeouts are so ubiquitously and obnoxiously high. Still, 2-3 seconds is not a lot. I've seen connections to web servers etc. take longer than that on occasion, even over highspeed.
# 7  
Old 06-10-2010
I read this somewhere on an Arpanet newsgroup long ago:

If you want a sockets timeout number:
Pick 10 seconds as a base

Pick your users average behavior mode:
Code:
screamers               10
impatient                  3
quiet, easy going       1

Mutliply the base number x the number in the table above. Use that in your timeval struct for the select() call.

This is meant as joke but timeouts can range up to as high as several minutes, not seconds. I would consider a minimum of 30 seconds.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Creating a .profile, displaying system variables, and creating an alias

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Here is what I am supposed to do, word for word from my assignment page: 1. Create/modify and print a... (2 Replies)
Discussion started by: Jagst3r21
2 Replies

2. IP Networking

Clarification - Setting socket options at the same time when socket is listening

I need clarification on whether it is okay to set socket options on a listening socket simultaneously when it is being used in an accept() call? Following is the scenario:- -- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Discussion started by: jake24
2 Replies

3. Programming

Error with socket operation on non-socket

Dear Experts, i am compiling my code in suse 4.1 which is compiling fine, but at runtime it is showing me for socket programming error no 88 as i searched in errno.h it is telling me socket operation on non socket, what is the meaning of this , how to deal with this error , please... (1 Reply)
Discussion started by: vin_pll
1 Replies

4. Programming

socket function to read a webpage (socket.h)

Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct... #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include... (3 Replies)
Discussion started by: cyler
3 Replies

5. Shell Programming and Scripting

help needed with creating challenging bash script with creating directories

Hi, Can someone help me with creating a bash shell script. I need to create a script that gets a positive number n as an argument. The script must create n directories in the current directory with names like map_1, map_2 etcetera. Each directory must be contained within its predecessor. So... (7 Replies)
Discussion started by: I-1
7 Replies

6. UNIX for Advanced & Expert Users

Why root permissions required for creating of RAW Socket

To create RAW socket in Unix/Linux why should one have root permissions? Any other work around to create raw sockets in Unix/Linux using a normal login id? Since I don't have super user credentials and I want to create RAW sockets. Let me know if you are aware of any work around. (3 Replies)
Discussion started by: anilgurwara
3 Replies

7. Programming

which socket should socket option on be set

Hi all, On the server side, one socket is used for listening, the others are used for communicating with the client. My question is: if i want to set option for socket, which socket should be set on? If either can be set, what's the different? Again, what's the different if set option... (1 Reply)
Discussion started by: blademan100
1 Replies

8. UNIX for Advanced & Expert Users

connect problem for sctp socket (ipv6 socket) - Runtime fail Invalid Arguments

Hi, I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime. To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies

9. Programming

Socket Programming socket

Hello, I actually try to make client-server program. I'm using SCO OpenServer Release 5.0.0 and when I try to compile my code (by TELNET) I've got this error : I'm just using this simple code : and I get the same error if I use : If someone can help me, Thanks (2 Replies)
Discussion started by: soshell
2 Replies

10. Programming

How to use the socket

I must write some codes about client/server architecture. The server program send the data to the client program,And the data is huge count and I want to implement that If some error happen and traslation of the data is interrupted,The program can send the data to the client program from the pos... (1 Reply)
Discussion started by: niuzefeng
1 Replies
Login or Register to Ask a Question