Questions tagged [sendto]

sendto() is a system call used to transmit a message to another socket.

sendto() is a system call used to transmit a message to another socket. It is used on a connection-mode socket.

Reference:

217 questions
1
vote
1 answer

How to read and transfer PDF files in C with fread()

I'm writing TFTP client in C. So far I had no problem with reading file into buffers(512 B) and transfer it to the server. However I'm struggling to read files like PDF that contains binary data. size_t nmemb = fread(data_buf, sizeof(char),…
ahOw22
  • 25
  • 5
1
vote
1 answer

problems sending structure UDP Socket

I'm new to c++ and need help. I use an UDP server to receive structure however i have problem to read it , the client send a structure I call : ChannAccessReq so the structure is send and the server receive it with RECVFROM and I use a general…
et11enne
  • 377
  • 1
  • 11
1
vote
1 answer

C++ send boost::dynamic_bitset with Winsock2 sendto function

I am trying to send raw bits from a boost::dynamic_bitset with the Winsock2 sendto function. MS documentation shows that sendto uses const char * type for the buffer parameter. How do I send only the raw bits stored in the dynamic_bitset? I don't…
Lee Exothermix
  • 316
  • 2
  • 3
  • 14
1
vote
1 answer

Error with sendto() function: Invalid Argument Error

I am working on writing a ping CLI program for linux and I have been getting errno 22: invalid argument in the sendto() function. I don't understand why, all the arguments seem to be correct. Here is where I call the function: // send echo…
1
vote
1 answer

Why does sendto() via Perl Socket->send() ignore the peer address?

I have a program (too complex to present here) that uses an UDP socket created by IO::Socket::INET->new() with both, Local... and Peer... address and port. So expectation is that a plain $sock->send($data, $flags) will send $data to the peer…
U. Windl
  • 3,480
  • 26
  • 54
1
vote
0 answers

Send to mail recipient vbscript not longer working

I used to use below VBscript to send files by mail as attachments to be able to add my signature in the e-mail message. Since about two weeks the VBscript is showing an error every time I try to send a file. I tried to use normal "send to/mail…
1
vote
1 answer

Python sendto() not executing

I have a program that accepts coordinates over UDP, moves some equipment around, and then replies when the job is done. I seem to have the same issue as this guy: Python sendto doesn't seem to send My code is here: import socket import struct import…
scs675
  • 15
  • 6
1
vote
1 answer

C sendto works sometimes...just stops after some time... NO ERRORS

Ive been getting strange results with the sendto function in C.(LINUX) What I am trying to do is to implement a reliable UDP kind of scheme. The snippet of code provided below is a part of the timer that expires when a packet is dropped and sends a…
1
vote
2 answers

UDP - Error in sendto(): Address family not supported by protocol

The following code is a programming sample for using UDP sockets. There are 3 .c source files (Client_UDP.c, Server_UDP.c, and Message_UDP.c), and 1 .h header file (Prototype.h). I want the Server and Client to communicate with each other only…
Leonardo
  • 89
  • 1
  • 10
1
vote
1 answer

Input-dependent error: sendto() error code 22 (Invalid argument) depending on input size

I'm having issues implementing a C UDP socket program. The code below works perfectly with any input shorter than 56 characters, but if I feed it 56 characters or more, sendto complains that I gave it invalid arguments (error code 22). For instance,…
Sean Bone
  • 3,368
  • 7
  • 31
  • 47
1
vote
2 answers

Are sockets allowed to be global in C?

I'm making a program that is constantly checking to receive and send data through a socket, and I have the socket declared globally and it's used inside 2 thread functions. I setup the socket in main(), and one thread uses recvfrom using the socket…
Caleb lee
  • 43
  • 7
1
vote
2 answers

sendto sends garbage (VBA)

I am reusing the code from here with some changes - added private keyword to some definitions because Excel VBA was reporting errors and changed type to IPRAW/ICMP. At the end I see garbage in the wireshark in the data section of the packet,…
Anonymous
  • 561
  • 3
  • 7
  • 24
1
vote
1 answer

Sending a single unsigned char through a socket using UDP in C

I am trying to send a single unsigned char through a buffer. I am using a buffer of size 2 unsigned char temp_buf [2]; temp_buf [0]= (unsigned char) 0xff; temp_buf [1]= NULL; and my sendto functions looks like this: if (sendto(fd, temp_buf, sizeof…
az_1993
  • 27
  • 8
1
vote
0 answers

UDP sendto packet sent signal

I'm developing an application that sends a lot of messages by an UDP connection. Sometimes some packets were lost and after some tests I conclude that the socket was busy. Thus I put a tiny sleep between calls to sendto API trying to prevent a new…
Valmir
  • 401
  • 1
  • 5
  • 14
1
vote
3 answers

Raw socket sendto failed using C on Linux

I'm trying to send a raw packet using UDP, with the IP and UDP headers that I have constructed in my code. Raw packet successfully initialized with socket(PF_INET, SOCK_RAW, IPPROTO_UDP) and socket option set using setsockopt(sd, IPPROTO_IP,…
Jeff
  • 337
  • 2
  • 4
  • 14