Pulkit Gaur

dream - do - deserve

UDP Data Xchange

Filed under: C at 02:36:04 On 2006-07-11

Was working on a UDP dataXcahnge project ,thought this code fragment will be of some use to newbees.

 

Server Code :

 

#include <netinet/in.h>

#include <sys/socket.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <arpa/inet.h>
#include <sys/types.h>


#define BUFLEN 512
#define PORT 10000

void die_err(char *s)
{
    perror(s);
    exit(1);
}

int main(void)
{
    struct sockaddr_in *sock_server, *sock_client;
    int s;
    socklen_t socklen=sizeof(struct sockaddr_in);
    char buf[BUFLEN];

    sock_server = malloc( socklen );
    sock_client = malloc( socklen );
    if ( !sock_server || !sock_client )
        die_err( "allocation failed" );
    if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
        die_err("socket");
    sock_server->sin_family = AF_INET;
    sock_server->sin_port = htons(PORT);
    sock_server->sin_addr.s_addr = htonl(INADDR_ANY);
    if ( bind(s, (struct sockaddr *)sock_server, socklen )==-1)
        die_err("bind");

    while( 1 ) {
        if (recvfrom(s, buf, BUFLEN, 0,
                     (struct sockaddr *)sock_client, &socklen)==-1)
            die_err("recvfrom()");
        printf("Received packet from %s:%d\nData: %s\n",
               inet_ntoa(sock_client->sin_addr),
               ntohs(sock_client->sin_port), buf);
    }

    close(s);
    return 0;
}

 

 

 Client Code :

 

#include <netinet/in.h>

#include <sys/socket.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <arpa/inet.h>
#include <sys/types.h>



#define BUFLEN 512
#define PORT 10000
#define USERVER "127.0.0.1"

void die_err(char *s)
{
    perror(s);
    exit(1);
}

int main(void)
{
    struct sockaddr_in *sock_server;
    int s, i;
    socklen_t socklen=sizeof(struct sockaddr_in);
    char buf[BUFLEN];

    sock_server = malloc( socklen );
    if ( !sock_server )
        die_err( "allocation failed" );
    if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
        die_err("socket");
    sock_server->sin_family = AF_INET;
    sock_server->sin_port = htons(PORT);
    if (inet_aton(USERVER, &(sock_server->sin_addr))==0) {
        fprintf(stderr, "inet_aton() failed\n");
        exit(1);
    }

    for (i=0; i<3; i++) {
        printf("Sending packet %d\n", i);
        sprintf(buf, "This is packet %d\n", i);
        if (sendto(s, buf, BUFLEN, 0,
                   (struct sockaddr*)sock_server, socklen)==-1)
            die_err("sendto()");
    }

    close(s);
    return 0;
}

List of device bandwidths

Filed under: General at 05:49:21 On 2006-07-11

A list comparing the device bandwidths can be found here

 

Worth Noting : 

 

Slowest Device         : Modem 10 B/s

Fastest till 2005-Feb : Prototype DDR3-SDRAM (8.528 GB/s)

 

In telecommunications : 1 kbit/s = 1 000 bit/s, NOT 1 024 bit/s

 

 

Default BIOS Passwords

Filed under: General at 01:47:12 On 2006-07-07

These are some of the default passwords in case you forgot yours.

 

WARNING: Some BIOS configurations will lock you out of the system completely if you type in an incorrect password more
than 3 times. Read your manufacturers documentation for the BIOS setting before you begin typing in passwords.



Award BIOS backdoor passwords:

ALFAROME BIOSTAR KDD ZAAADA
ALLy CONCAT Lkwpeter ZBAAACA
aLLy CONDO LKWPETER ZJAAADC
aLLY Condo PINT 01322222
ALLY d8on pint 589589
aPAf djonet SER 589721
_award HLT SKY_FOX 595595
AWARD_SW J64 SYXZ 598598
AWARD?SW J256 syxz
AWARD SW J262 shift + syxz
AWARD PW j332 TTPTHA
AWKWARD j322 awkward



AMI BIOS Backdoor Passwords:

AMI BIOS PASSWORD HEWITT RAND
AMI?SW AMI_SW LKWPETER CONDO


Phoenix BIOS Backdoor Passwords:

phoenix PHOENIX CMOS BIOS


Misc. Common Passwords:

ALFAROME BIOSTAR biostar biosstar
CMOS cmos LKWPETER lkwpeter
setup SETUP Syxz Wodj


Other BIOS Passwords by Manufacturer:



Manufacturer Password
VOBIS & IBM merlin
Dell Dell
Biostar Biostar
Compaq Compaq
Enox xo11nE
Epox central
Freetech Posterie
IWill iwill
Jetway spooml
Packard Bell bell9
QDI QDI
Siemens SKY_FOX
TMC BIGO
Toshiba Toshiba


Toshiba BIOS


Most Toshiba laptops and some desktop systems will bypass the BIOS password if the left shift key is held down during boot

IBM Aptiva BIOS

Press both mouse buttons repeatedly during the boot