LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-11-2004, 04:01 AM   #1
Qwirt
LQ Newbie
 
Registered: Jul 2004
Location: Australia
Distribution: SUSE 9.0 (from a magazine)
Posts: 20

Rep: Reputation: 0
How do you send packets in ASM?


I was wondering if there was a way in ASM to send TCP/IP packets, equivalent to send, recv, sendto and recvfrom in C++.
 
Old 11-11-2004, 04:10 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,535

Rep: Reputation: 148Reputation: 148
Yes, but you'll need to call send, recv etc. Directly - no (you need to use OS functions for such operations).
 
Old 11-11-2004, 04:58 PM   #3
karlan
Member
 
Registered: Aug 2003
Location: San Francisco, California
Distribution: Slackware
Posts: 158

Rep: Reputation: 30
system call list: http://world.std.com/~slanning/asm/syscall_list.html


btw. you may have to use file functions to access the sockets, I have no clue how to do this tho.

example function:

Code:
	xorl %eax, %eax		# %eax = 0
	incl %eax		# %eax = 1, system call _exit ()
	xorl %ebx, %ebx		# %ebx = 0, normal program exit.
	int $0x80		# execute _exit () system call
 
Old 11-12-2004, 02:43 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,535

Rep: Reputation: 148Reputation: 148
To use library functions you can use the call instruction:
call socket
but first you need to put the right argiments to the stack (in the right order).
 
Old 11-13-2004, 03:11 PM   #5
karlan
Member
 
Registered: Aug 2003
Location: San Francisco, California
Distribution: Slackware
Posts: 158

Rep: Reputation: 30
what mara is trying to say it, you'll have to link to libc, or you could implement your own functions (very unlikeyly)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Send Packets Out even if Link Down? htlin Linux - Networking 1 09-22-2005 08:48 PM
Send packets manually Ephracis Programming 4 04-02-2005 04:56 AM
unable to send packets cranium2004 Linux - Networking 2 02-05-2005 10:28 PM
send packets at network Jamesminh Linux - Networking 0 10-01-2004 02:38 AM
recieve and send IP packets! Farhang Linux - Networking 1 07-25-2004 02:47 PM


All times are GMT -5. The time now is 05:31 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration