Programming :: Use Send() Instead Of Sendto() For UDP
Jan 20, 2010Can I use send() function to send UDP datagram through a socket instead of calling the sendTo()?
View 2 RepliesCan I use send() function to send UDP datagram through a socket instead of calling the sendTo()?
View 2 RepliesThe following is the UDP client code I am using.
Code:
Even the server is down, sendto function is not returning -1.
Instead, it is returning the length of the message as if it is success.
Whenever I enable gettimeofday in my code, previous working sendto(raw_eth, buffer, ...)
stopped working and Error: Bad file descriptor. the only thing I'm sure is it's not name pollution. Since all the variable defined in main() works if I make the wrap of gettimeofday an empty function.
I'm not sure why the sndto() is failing.
STATUS send_request(const packet_t * pkt)
{
int fd = -1; /* socket filedescriptor */
[code].....
I run a small home network with a wireless network using Apple airport wireless router. I have two macs and one Linux box (Fedora 13). Everything worked until about a week ago. Now the two macs can communicate with each other, and one of the macs can communicate with the Linux box, but the other can't, which is a bummer because it is a print server.
Pinging from the mac to the linux box gives the error message:
ping: sendto permission denied
Ping from the Linux box to the mac just hangs:
[/home/pjs] # ping 10.0.1.5
PING 10.0.1.5 (10.0.1.5) 56(84) bytes of data.
Firewalls on both boxes have been disabled. The Mac was running Little Snitch, but it has been uninstalled.
I have looked for messages from /var/log/message using tail -f and there are none when I ping either way.
ifconfig and /etc hosts, hosts.allow and hosts.deny look normal.
I'm running a fully updated version of natty beta 11.04.
The nautilus sendto dialog avaiable from the right-click menu is working normally, but doesn't include the evolution "send to email" option. I have evolution installed and it's working normally.
I am currently doing a research on video transmission over wireless LAN. I tend to transmit my offline file (xx.svc) from server to client.It may sound stupid (since I have a very little knowledge about c programming and raw socket), but my biggest challenges is that when I want to write the file to the buffer, how actually to define/include the file at the programming coding? where I need to locate the file? Is it at the same folder with my c programming, or somewhere in the linuxinclude folder?
Can anyone just give a simple example on how to include a file and write it into a buffer before send it through raw socket.
this is my client and server. I can receive text file. but I can't send other type of file like PDF,Docx,Odt
View 11 Replies View RelatedHas anyone had an issue with gdb not being able to send a UDP msg across a socket?
I have ComponentA sending a msg to ComponentB utilizing gdb. ComponentB gets the msg. ComponentB sends a msg to ComponentC. ComponentC does stuff to the msg and sends a msg back to ComponentB using gdb.
ComponentB never seems to receive the 2nd message.
If I don't use gdb the messages Tx and Rx without an issue.
I'm flying blind without gdb to figure out a different bug.
I'm trying to use expect to telnet to web server and send HTTP command like POST, GET, etc.
Here's my code...
But this gives an error
couldn't read file "/cgi-bin/authgw-cgi": no such file or directory
I think this is because of /
How to send / in expect?
have a file (called it A) contains;
hostname 192.168.23.65
hostname 10.18.13.253
hostname 10.18.16.253
hostname 177.23.56.58
how can i write a script to get only ip addresses & send it to 3 files with the following info. only:
file1:
192.168.0.0
file2:
10.18.0.0
file3:
177.23.0.0
by creating the 3 files then i will be able to set up subnetmask, gw,....etc.
Been trying all sorts of different things to implement a non-blocking send on a TCP server socket.As I kill the client, the server keeps blocking on the send no matter what. Am I missing something? Any other way to do that without involving any additional thread?
View 4 Replies View RelatedCan someone help me with this problem,trying to send a packet,using tcp/ip,the packet should look like this:
Code:
field 1: SOCKS protocol version, 1 byte (0x05 for this version)
field 2: status, 1 byte:
0x00 = request granted
0x01 = general failure
0x02 = connection not allowed by ruleset
0x03 = network unreachable
0x04 = host unreachable
0x05 = connection refused by destination host
0x06 = TTL expired
0x07 = command not supported / protocol error
0x08 = address type not supported
field 3: reserved, must be 0x00
field 4: address type, 1 byte:
0x01 = IPv4 address
0x03 = Domain name
0x04 = IPv6 address
field 5: destination address of
4 bytes for IPv4 address
1 byte of name length followed by the name for Domain name
16 bytes for IPv6 address
field 6: network byte order port number, 2 bytes
and this is my code:
Code:
int domainLen = strlen(domain);
char reply[domainLen + 7];
reply[0] = 5; // version
reply[1] = 0; // succed
reply[2] = 0; // reserved
reply[3] = 3; // its a domain
reply[4] = domainLen;; // lenght of domain
for(int j = 0; j < domainLen; ++j)
{
reply[j + 5] = domain[j];
}
reply[5 + domainLen] = 80; // port
reply[20] = '�';
Send(reply, sizeof(reply));
domain is "www.google.com". Am I doing it right ? I dont know much about bits.
I want to send a message from IP to Another IP through command prompt. how can i do this.s
View 3 Replies View RelatedHow I send clipboard to festival or what is wrong here? #!/bin/bash
text='xclip -selection clipboard -o'
echo '(voice_nitech_us_awb_arctic_hts) (SayText "$text")' | festival
Says only "dollar text" to me. Just this works, but I want other script with different voice: #!/bin/bash
xclip -selection clipboard -o | festival --tts Voice changed here: echo '(voice_nitech_us_awb_arctic_hts) (SayText "say this please")' | festival
How can I send and receive packets using libpcap, reply as early as possible.
View 1 Replies View RelatedI am not a profession programmer. I have to write a C code which send some command to attach display using C program. Can any one please help me in this regard.
View 3 Replies View RelatedI want to send Epson ESC sequences to control the printer from terminal.
I figured out if I send
Quote:
echo $FF>/dev/lp0
that is equal to sending 'FF' control sequence. But I have problem when I need to send sequences like,
1. ESC 0 . I sent
Quote:
echo $ESC $0>/dev/lp0
,
Quote:
echo $"ESC 0">/dev/lp0
. They do not work as expected.
2. ESC HT 5 4 (To control Horizontal Tabbing)
How can it be done in bash?
I want to send Received UDP Packets to neighbor MAC Address. Anyone can guide me to how to do it?
I can received UDP packets and then forward to unicast address as follow: How can i modify this codes (Maybe Last Line) to send the received packets to destination MAC Address instead of destination IPv6 Address?
Code:
int main(int argc, char ** argv)
{
int s,s1;
struct sockaddr_in6 a,a1;
[Code]....
i have a client and server program in C. in that program server is requesting some parameters from client (like systems up time, total memory, no of process running etc).for this i used switch statements. but the problem i am having with this is that,
1. it is always going in default case on client side.2. and i also want my program to send requests/messages to client periodically. means after some interval (say after every 2,3 mins) server sends next request to client.
I need to send email through perl using CSS.Eventhough the mail is sent,all i see in my thunderbird is html code.
Css file:
Code:
table.pretty {
margin: 1em 1em 1em 2em;
background: whitesmoke;
border-collapse: collapse;
[code]....
This works but with out stylesheets if i use text/html,and i see html code if iuse text/css.
I need to write a command line script.
I have scribus install on my machine which someone suggested would do what I want. It does. But unfortunately I can not get it to work. The text print screen freezes when it is loading a font and will not respond.
One of the other disadvantages with scribus I did find was it wanted to print the fonts in all the size available and at 3 per page I have enough fonts to fill 607 pages.
I have googled, read all the scripting books I have, read several online tutorials and have not found a way to send a request for a certain style font to the printer from the command line.
I have this problem.I need to do this:I got a small version of Linux installed in some small devices. These devices come from the provider with this small version of Linux installed.This devices should send data to some other machine in the internet. I have tested wput for this purpose with a PC which has an Ubuntu version 10 and it works fine. However, when I try wput in the small device, I get an error. It seems that the wput might need some libraries to work with the small version of Linux installed in the small device.The fact of using wput or not is optional. I just need being able to send files through ftp with this small version of Linux.The thing is that to be able to run wput in this small version of Linux, it seems that many of the needed libraries were missing. So what I did was just install all the needed libraries. But still the wput program fails in its first line.
View 14 Replies View RelatedIs there a library to send mail via c/c++ code in linux ? Or what can I use ?
View 1 Replies View Relatedhow can i send a text file from server to client? the problem is, i dont know how to send those two file to the client ( center node)
View 1 Replies View Relatedtrying to see IF i dont get the right results repeat the command until it will or quit after 3 tries....
expect -exact "->"
send -- "test_read_register 0,0x37
"
if {! [regexp {Address 0x00000000} do send -- "test_read_register 0,0x37
[code]....
It should read
Read: Address 0x00000037, Data: 0x0000000b
but sometimes it comes out to this
Read: Address 0x00000000, Data: 0x00000000
therefore ill have to run the command again IF I Dont get the right results...
I'm setting up a machine that's going to be used to test randomly connected tape drives one at a time, and as such, I'm writing the test routine using mt in a bash script, for user-friendliness. The problem is the block device name changes on occasion as tape drives are swapped out and busses are rescanned, so I can't "hard code" a block name into the script.
I know programs like lsscsi and hwinfo will give you block device names as part of their output, but I can't seem to grep anything in such a way as to have the final output be just the block name (ie /dev/st2, or optimally 'st2'), so that I can just have the script read said output, and drop it into the necessary variable.
i will be quick, im trying to send a mysql query output into an array ie:
Code:
declare -a HD
HD=`echo "USE db; SELECT uid FROM user" | mysql -u $login -p$pwd -h $dbhost -B`
echo ${#HD}
those vars in mysql connection are previously and correctly assigned.
but got an error
script.sh: 2: declare: not found
Hi, is it possible to send a request to a http server without using sockets?
View 7 Replies View RelatedI am trying to generate a UDP syslog packet from my C application. But I am facing a problem with a Cisco Router ACE that does not like the Source Port being '0' and thus drops the packet.How can I specify the Source Port in the UDP header to '514' as stated in RFC3164 (Section 2: Transport Layer Protocol)? "It is RECOMMENDED that the source port also be 514 to indicate that the message is from the syslog process of the sender"
View 1 Replies View Related