Unix Programming - Re: sending a packet using raw socket

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > April 2006 > Re: sending a packet using raw socket





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: sending a packet using raw socket
phil-news-nospam@ipal.net

2006-04-02, 7:41 pm

On 24 Mar 2006 02:01:45 -0800 mangesh sawant <mangesh@interinfosystems.com> wrote:

| first i have doubt wethere one can send structure over network .

It is very possible to do. I've done it. But there are big portability
issues that it is better to use other methods to address.


| Try following ,
| 1 - take a character array say char data[900] .
| 2 - strcpy(data , "");
| 3- strcat(data , "data u want to send");

Why not just

2 - strcpy(data, "data u want to send");


| now send this 'data' over network

Even that doesn't address portability issues of the struct itself is what is
copyed into the character array.


| i have done this for stream sockets . if raw sockets can send
| structures over network ignore this .

They can. You just have to be more careful.

--
-----------------------------------------------------------------------------
| Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
| (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/ |
-----------------------------------------------------------------------------
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com