53 questions
0
votes
1
answer
163
views
Prevent Tkinter askopenfilenames from ordering files
I try to make a tool that can merge multiple pdf file types, I use askopenfilenames method, select the files and when I print the files it looks like they are ordered alphabetically. Is there a way to ...
-1
votes
1
answer
306
views
select() returns 0 immediately on non-blocking AF_PACKET socket ignoring timeval
My Linux code below is supposed to search all interfaces until it gets a response from a particular MAC address using ETHERNET type 2 frames.
It is not complete.
I want select() to block for the ...
0
votes
1
answer
213
views
C - How to cycle a socket
I have a program which prints the content of a file which I send:
struct addrinfo hints;
struct addrinfo *serverInfo;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints....
0
votes
2
answers
68
views
Breaking out of select for no reason
I am doing something like this
val = select(max_fd+1,&readfd,0,0,0);
if(val >=1){
printf("I have got some value");
}
My code breaks out of select for no reason. It receives no packet. On ...
4
votes
1
answer
2k
views
Knowing which file-descriptors are ready after select() call in C
I'm new to socket programming and I've been introduced to the select() system call. My question is, lets say I'm writing a server in C (which I am attempting to do) and I want to use the select() call ...
0
votes
3
answers
140
views
How to get the interface I am connected to
I am trying to implement an application which receives a packet(ICMP maybe) on a tap interface. I have the code something like this.
strcpy(ifName, "tap0");
if ((sockfd = socket(PF_PACKET, SOCK_RAW,0)...
1
vote
1
answer
3k
views
select for timeout over TCP socket
I have a problem with this code:
FD_ZERO(&cset);
FD_SET(s, &cset);
tval.tv_sec = TIMEOUT;
tval.tv_usec = 0;
n = select(FD_SETSIZE, &cset, NULL, NULL, &tval);
if (n==-1) {
...
1
vote
1
answer
2k
views
Non-blocking connect() and EINTR
I am using connect_nonb() from Stevens, UNIX Network programming:
int
connect_nonb(int sockfd, const SA *saptr, socklen_t salen, int nsec)
{
int flags, n, error;
socklen_t ...
3
votes
2
answers
4k
views
Is there a Windows equivalent for eventfd?
I am writing a cross-platform library which emulates sockets behaviour, having additional functionality in the between (App->mylib->sockets).
I want it to be the most transparent possible for the ...
0
votes
3
answers
3k
views
Why does select() always time out? (windows)
I'm using select to try and wait for an acknowledgement from another host on the network, but it always returns 0. I've seen other threads with similar questions, and their problem is always either ...
-2
votes
2
answers
2k
views
select() in a proxy server
I am building a proxy server in c and I'm trying to understand the select() function. I have the code done so that a connection is made from a client and then the web address is extracted so that ...
0
votes
1
answer
2k
views
select() not detecting incoming data
Objective: N nodes (running on different machines) should communicate with each other by establishing TCP connections with each other. Sending and receiving messages are done by 2 threads created by ...
1
vote
1
answer
493
views
C exec/pipe/select program - missing input from child
I have a program which spawns off a child script. The child script simply respews any input 1/2 the time back to STDOUT and STDERR. The other half the time, it quietly consumes it. What I am getting ...
8
votes
2
answers
7k
views
Read signaled by select(), but recv() returns no data and signal EAGAIN on non-blocking sockets
I have got signaled socket for read from select(), but then no data arrived by recv call(), instead it returns -1 with errno==EAGAIN.
I can grant that no other thread touch the socket.
I think that ...
1
vote
1
answer
767
views
Using Telnet to test select()
I am fairly new to Linux/socket programming. I am using select to check connections in my server program (it will eventually be a chatroom server). I am using telnet to test it and something weird is ...
0
votes
2
answers
4k
views
c socket prog - select() problems
I'm new to network programming. I have to write a simple client/server program in C. The server will listen for a connection and the client will connect to the server, send a message, and receive an ...
0
votes
2
answers
515
views
Open /dev/ttyUSB* when it becomes present
I have a program that will always be running when the computer is. It interfaces with serial over USB device. At times the device may not be present when the computer is on.
My question is a good ...
3
votes
2
answers
4k
views
Select (Linux) function always returns 0
Select function in my case always returns zero, which is timeout and this is happening continuosly so my CPU usage also going upto 98 % for my process. I have also tried to set NULL instead of seting ...
2
votes
1
answer
580
views
select() timeout of 3s even on ICMP port unreachable
When I try to connect to a server with a non blocking socket (so that i can use select() with a timeout parameter) i realized that on a connect to a port which is blocked by iptables with -j REJECT ...
2
votes
4
answers
2k
views
select() times out immediately after long runtime (C++)
Most of the time this code works just fine. But sometimes when the executable has been running for a while, select() appears to time out immediately, then get into a weird state where it keeps getting ...
4
votes
2
answers
6k
views
Using sleep and select with signals
I want to use the select() function to wait for 1 second, as my program uses signals to control stuff, so sleep() would return prematurely. The weird thing is that when using select() it also returns ...
0
votes
2
answers
592
views
Is select function internaly call tcp connect?
Code Sinnpet:
int CreateaTCPSocket()
{
int iSockID = ACE_OS::socket(......);
ACE_OS::set_flags(iSockID,O_NONBLOCK);
ACE_OS::bind();
if (ACE_OS::connect(iSockID ,....) < 0)
{
...
13
votes
5
answers
41k
views
C, socket programming: Connecting multiple clients to server using select()
I'm trying to make a server that can be connected to by multiple clients. Here's my code so far:
Client:
int main(int argc, char **argv) {
struct sockaddr_in servaddr;
int sock = socket(AF_INET,...
1
vote
3
answers
419
views
Select behavior
It could probably be a simple question but I couldn't find a clear answer for it. I have multiple threads in c code and one of them uses select to wait for n seconds. The question that I have is that ...
3
votes
2
answers
133
views
select failing with C program but not shell
I have a parent and child process, and the parent can read output from the child and send to the input of the child. So far, everything has been working fine with shell scripts, testing commands which ...