User Profile

Collapse

Profile Sidebar

Collapse
Ramsin
Ramsin
Last Activity: Aug 30 '11, 07:06 PM
Joined: Jul 16 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Ramsin
    started a topic Downloading (a webpage) in C++
    in C

    Downloading (a webpage) in C++

    Hi, I'm fairly new to socket/network programming.
    Code:
    #include <iostream>
    #include <cstring>
    #include <cstdlib>
    #include <fstream>
    #include <sys/socket.h>
    #include <sys/types.h>
    #include <netinet/in.h>
    #include <arpa/inet.h>
    
    using namespace std;
    int main() {
    	int sockfd;
    	sockaddr_in addr;
    	char rqt[]
    ...
    See more | Go to post

  • Ramsin
    started a topic Arrays and functions
    in C

    Arrays and functions

    Hi, read the following code,
    Code:
    #include "IntegerArray.h"
    using namespace std;
    
    int main() {
    	int size, n;
    	
    	cout << "Size of a single array: ";
    	while(true) {
    		cin >> size;
    		cin.ignore();
    		if(size >= 1 && size <= 100) break;
    	}
    	
    	int * a = new int[size];
    	int * new_a = new int[size];
    	int
    ...
    See more | Go to post

  • Ramsin
    replied to How to avoid such DoS attacks?
    My question is: How would you protect a system from that flooding attack?
    See more | Go to post

    Leave a comment:


  • Ramsin
    replied to Good Assembly Guide(s) for C++ Debugging
    in C
    This is really good too: http://en.wikibooks.org/wiki/X86_Disassembly
    See more | Go to post

    Leave a comment:


  • Ramsin
    replied to Good Assembly Guide(s) for C++ Debugging
    in C
    Btw, I found this paper (http://mariano-graziano.llab.it/docs/stsi2010.pdf) really clear and informative, and I've begun reading it.
    See more | Go to post

    Leave a comment:


  • Ramsin
    replied to Overflow and bytes
    in C
    I thought it was also system/compiler dependant, but I was unsure. Anyway, I must learn about such things, because it's necessary to clearly understand how memory works.
    See more | Go to post

    Leave a comment:


  • Ramsin
    replied to Good Assembly Guide(s) for C++ Debugging
    in C
    I need to understand what's going on there, while working with memory.
    See more | Go to post

    Leave a comment:


  • Ramsin
    started a topic Good Assembly Guide(s) for C++ Debugging
    in C

    Good Assembly Guide(s) for C++ Debugging

    Do you know one or more clear (and quick) papers/tutorials/books to explain the general essentials of assemblers (esp. IA-32bits), only for debugging purposes? To learn about assembly is yet another large field. I've learned the very basics, but I currently have no time to study it extensively. Thanks...
    See more | Go to post

  • Ramsin
    replied to Overflow and bytes
    in C
    Code:
    (gdb) run
    Starting program: /home/ramsin/Desktop/a.out 
    AAAABBBBCCCCDDDD
    
    Program exited normally.
    (gdb) r
    Starting program: /home/ramsin/Desktop/a.out 
    AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDD 
    
    Program exited normally.
    (gdb) r
    Starting program: /home/ramsin/Desktop/a.out 
    AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDDF
    
    Program received signal SIGSEGV, Segmentation fault.
    ...
    See more | Go to post

    Leave a comment:


  • Ramsin
    replied to returned constant pointer, sizeof()
    in C
    Obs, just noticed: The function actually returns a const pointer, not a const double. Since that pointer is constant, which should be the reason why is the size of that function equal to four.

    EDIT[0]: Correct me if I'm wrong :)
    EDIT[1]: Size of double is actually 64-bits.
    See more | Go to post

    Leave a comment:


  • Ramsin
    started a topic Overflow and bytes
    in C

    Overflow and bytes

    Sizeof(a) must be 4 bytes, but why does the overflow occur when I enter at least over 32 characters?!
    Code:
    // HHHe...
    #include <iostream>
    using namespace std;
    
    int main() {
    	char a[4];
    	string str;
    	
    	cin >> str;
    	cin.ignore();
    	
    	int i;
    	for(i=0; i<(str.length()); i++) {
    		a[i] = *(str.c_str()+i);
    	}
    	
    	/* char * p = &(a[7])+i;
    ...
    See more | Go to post

  • Ramsin
    started a topic How to avoid such DoS attacks?

    How to avoid such DoS attacks?

    I'm using hping3 on Ubuntu.
    Code:
    #!usr/bin/bash
    # no-jkpg-msg
    
    while true; do
    hping3 [ip_addr] -A -f -p [port_nr] -i u100 --spoof [ip_addr]
    # hping3 [ip_addr] --udp -f -i u100 -p [port_nr] --spoof [ip_addr]
    # hping3 [ip_addr] -S -f -p [port_nr] -i u100 --spoof [ip_addr]
    # etc...
    done
    I've tested my servers using such operations. If such a command is executed once, then "[send_ip]...
    See more | Go to post

  • Ramsin
    started a topic returned constant pointer, sizeof()
    in C

    returned constant pointer, sizeof()

    Why is the size of the returned pointer, r, equal to four? And why, in (cout << "(" << sizeof(e(i))... ), the e(i) value is returned, but the (cout) in the same e(i) does not print "Hello"? Thanks for help...

    Code:
    // obs! --> jpkg-msg
    #include <iostream>
    using namespace std;
    
    double* const e(double * const);
    
    int main() {
    	double i[11];
    ...
    See more | Go to post

  • Ramsin
    replied to Creating Random elements in an array
    in C
    Read about srand: http://www.cplusplus.com/reference/c...cstdlib/srand/
    See more | Go to post

    Leave a comment:


  • Ramsin
    replied to Creating Random elements in an array
    in C
    Code:
    #include <iostream>
    #include <cstdlib>
    #include <ctime>
    using namespace std;
    
    int main() {
    	srand(time(NULL));
    	int n = rand()%10 + 1;
    	int a[n];
    	
    	for(int i=0; i < 10; i++) {
    		a[i] = rand()%100 + 1;
    		cout << a[i] << endl;
    		i++;
    	}
    }
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...