LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How do you send packets in ASM? (https://www.linuxquestions.org/questions/programming-9/how-do-you-send-packets-in-asm-253538/)

Qwirt 11-11-2004 04:01 AM

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++.

Mara 11-11-2004 04:10 PM

Yes, but you'll need to call send, recv etc. Directly - no (you need to use OS functions for such operations).

karlan 11-11-2004 04:58 PM

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


Mara 11-12-2004 02:43 PM

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).

karlan 11-13-2004 03:11 PM

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


All times are GMT -5. The time now is 10:57 PM.