Fleeting/Random/Thoughts

Relax, kick those feet up. Enjoy a few laughs and take it easy.

Re: Fleeting/Random/Thoughts

Unread postby Bluefire » 26 Apr 12, 10:26 pm

I have hot chocolate milk :) In one of those tall milkshake thinys.
Its yummy.
Image
Bluefire

User avatar
Jedi Upstart
 
Offline
Posts: 722
Joined: 8 Jul 03, 5:08 am
Location: Hiding: The path of truth leads to purgatory.

Re: Fleeting/Random/Thoughts

Unread postby CelticAngel82 » 26 Apr 12, 10:38 pm

Oh yeah I know all about soaking for burns.. partner did the same trick as you, (only his burn was heat, blistered up straight away.. after ice water soaking, no scar) but anyway yeah..
your face, needs moar face.
CelticAngel82

User avatar
Story Teller
 
Offline
Posts: 1681
Joined: 1 Sep 05, 5:42 pm
Location: Cairns

Re: Fleeting/Random/Thoughts

Unread postby cyclobs » 26 Apr 12, 11:07 pm

just did up a flight video in fsx... it's terrible
Image
cyclobs

User avatar
Forgotten What The Sky Looks Like
 
Offline
Posts: 2437
Joined: 9 Feb 08, 7:16 pm
Location: Narrabri

Re: Fleeting/Random/Thoughts

Unread postby Anon. E. Moose » 27 Apr 12, 1:01 am

I hate working late shifts, I just end up pinging the **** out when I get home and can't sleep.
Steam: Shpleboy
Minecraft: LogicalHero
Battlefield 3: LogicalHero
Has a significantly better avatar than lee.
Anon. E. Moose

User avatar
Story Teller
 
Offline
Posts: 1725
Joined: 5 Oct 10, 12:40 pm
Location: ACT

Re: Fleeting/Random/Thoughts

Unread postby Disco LT » 27 Apr 12, 6:35 am

Anon. E. Moose wrote:It's on Steam, ~1.5GB download. Worth every bit of bandwidth.


Done and dusted last night, had a blast! Will wait and see if my regular cd key site gets them cheaper than they are on Steam after release :D

I just almost spat coffee all over my keyboard.. read a remark on a website about the protests at Parliment over those idiots in Kings Cross the other night that ran over the lady and were shot at by Police.

"I should have stolen a car, got pissed and rammed the car into their protest, it might give them better perspective".. :lol: :lol: :lol:
Last edited by Disco LT on 27 Apr 12, 10:59 am, edited 1 time in total.
Image
Disco LT

User avatar
Forgotten What The Sky Looks Like
 
Offline
Posts: 2768
Joined: 10 May 11, 6:40 pm
Location: New South Wales

Re: Fleeting/Random/Thoughts

Unread postby cyclobs » 27 Apr 12, 10:24 am

awesome! got my pingers all coded out.. even though i followed someone else's coding but once it all works i gotta change alot of it anyway to suit my program. i just needed to make sure i can ping stuff!

hopefully this will compile and then i gotta figure out how to.... use it :oops:

Hidden: show
Code: Select all
/*         Ping.cpp
   This file contains the ping function

   // reference: http://tangentsoft.net/wskfaq/examples/rawping.html
*/

#include "stdafx.h"
#include <iostream>
#include <WinSpool.h>
#include <WS2tcpip.h>
#include <Windows.h>

#include "ping.h"
using namespace std;

int ping (char *ping_this) {
   cout << "Pinging IP: " << ping_this << endl;

/*   if (ip_replied = true) {
      return 1;
   }
   else {
      return 0;
   }*/
   return 1;
}

// Ip Checksum creater
USHORT ip_checksum(USHORT* buffer, int size) {
   unsigned long cksum = 0;

   // Sum all the words together, adding the final byte if size is odd
   while (size > 1) {
      cksum += *buffer++;
      size -= sizeof(USHORT);
   }
   
   if (size) {
      cksum += *(UCHAR*) buffer;
   }

   // Do a little shuffling
   cksum = (cksum >> 16) + cksum & 0xffff);
   cksum += (cksum >> 16);

   // Return some ****
   return (USHORT) (~cksum);
}

int setup_for_ping (char* host, int ttl, SOCKET& sd, sockaddr_in& dest) {
      
   // Create the socket
   sd = WSASocket (AF_INET, SOCK_RAW, IPPROTO_ICMP, 0, 0, 0);
   if (sd == INVALID_SOCKET) {
      cout << "Failed to create raw socket: " << WSAGetLastError() << endl;
         
      return -1;
   }

   if (setsockopt (sd, IPPROTO_IP, IP_TTL, (const char*)&ttl, sizeof(ttl)) == SOCKET_ERROR) {
      cout << "TTL Setsockopt failed: " << WSAGetLastError() << endl;

      return -1;
   }

   // Initialize the destination block
   memset(&dest, 0, sizeof(dest));

   // Turn first passed parameter into an IP Address to ping
   unsigned int addr = inet_addr(host);
   if (addr != INADDR_NONE) {
      // It was a dotted quad number, So save result
      dest.sin_addr.s_addr = addr;
      dest.sin_family = AF_INET;
   }
   else {
      // Not in a dotted quad form, so try to look it up
      hostent* hp = gethostbyname(host);
      if (hp != 0) {
         // Found an host so lets save it
         memcpy(&(dest.sin_addr), hp -> h_addr, hp -> h_length);
         dest.sin_family = hp -> h_addrtype;
      }
      else {
         // Not an recognised host name either!
         cout << "Fail to resolve hostname: " << host << endl;
         return -1;
      }
   }

   return 0;
}

void init_ping_packet (ICMPHeader* icmp_hdr, int packet_size, int seq_no) {
   // Set up the packet's fields
   icmp_hdr -> type = ICMP_ECHO_REQUEST;
   icmp_hdr -> code = 0;
   icmp_hdr -> checksum = 0;
   icmp_hdr -> id = (USHORT)GetCurrentProcessId();
   icmp_hdr -> seq = seq_no;
   icmp_hdr -> timestamp = GetTickCount();

   // "You're dead meat now, Packet!"
   const unsigned long int deadmeat = 0xDEADBEEF;
   char* datapart = (char*) icmp_hdr + sizeof(ICMPHeader);
   int bytes_left = packet_size - sizeof(ICMPHeader);
   while (bytes_left > 0) {
      memcpy(datapart, &deadmeat, min(int(sizeof(deadmeat)), bytes_left));
      bytes_left -= sizeof(deadmeat);
      datapart += sizeof(deadmeat);
   }

   // Calculate a checksum on the result
   icmp_hdr -> checksum = ip_checksum((USHORT*) icmp_hdr, packet_size);
}

int send_ping(SOCKET sd, const sockaddr_in& dest, ICMPHeader* send_buf, int packet_size) {
   // Send the ping packet in send_buf as-is
   cout << "Sending " << packet_size << " Bytes to " << inet_ntoa(dest.sin_addr) << "..." << flush;
   int bwrote = sendto(sd, (char*) send_buf, packet_size, 0, (sockaddr*)&dest, sizeof(dest));
   
   if (bwrote == SOCKET_ERROR) {
      cout << "send Failed: " << WSAGetLastError() << endl;
      return -1;
   }
   else if {
      cout << "sent " << bwrote << " bytes..." << flush;
   }

   return 0;
}

int recv_ping (SOCKET sd, sockaddr_in& source, IPHeader* recv_buf, int packet_size) {
   // Wait for the ping reply
   int fromlen = sizeof(source);
   int bread = recvfrom(sd, (char*) recv_buf, packet_size + sizeof(IPHeader), 0, (sockaddr*)& source, &fromlen);

   if (bread == SOCKET_ERROR) {
      cout << "Read Failed: ";
      
      if (WSAGetLastError() == WSAEMSGSIZE) {
         cout << "Buffer too small" << endl;
      }
      else {
         cout << "error #" << WSAGetLastError() << endl;
      }
      return -1;
   }

   return 0;
}

int decode_reply(IPHeader* reply, int bytes, sockaddr_in* from) {
   // Skip ahead to the ICMP header within the IP packet
   unsigned short header_len = reply -> h_len * 4;
   ICMPHeader* icmphdr = (ICMPHeader*) ((char*) reply + header_len);

   // Make sure the reply is sane
   if (bytes < header_len + ICMP_MIN) {
      cout << "Too few bytes from " << inet_ntoa(from -> sin_addr) << endl;
      return -1;
   }
   else if (icmphdr -> type != ICMP_ECHO_REPLY) {
      
      if (icmphdr -> type != ICMP_TTL_EXPIRE) {
         
         if (icmphdr -> type == ICMP_DEST_UNREACH) {
            cout << "Destination Unreachable" << endl;
         }
         else {
            cout << "Unknown ICMP Packet type " << int(icmphdr -> type) << " received" << endl;
         }

         return -1;
      }
      // if "TTL Expired", fall though. Next test will fail if we try it, so we need to pass iot
   }
   else if (icmphdr -> id != (USHORT) GetCurrentProcessId()) {
      // Must be a reply for another pinger running locally, so just ignore it.
      return -2;
   }

   // Figure out how far the packet travelled
   int nHops = int(256 - reply -> ttl);

   if (nHops == 192) {
      // TTL came back 64, so ping was probably to a host on the LAN -- Call it a single hop!
      nHops = 1;
   }
   else if (nHops == 128) {
      // Probably localhost
      nHops = 0;
   }

   // Awesome, that packet must be a bitchen 18 year old. lets dump that ****
   cout << endl << bytes << " Bytes from " << inet_ntoa(from -> sin.addr) << ", icmp_seq " <<
      icmphdr -> seq << ", ";

      if (icmphdr -> type == ICMP_TTL_EXPIRE) {
         cout << "TTL expired." << endl;
      }
      else {
         cout << nHops << " hop" << (nHops == 1 ? "" : "s");
         cout << ", time: " << (GetTickCount() - icmphdr -> timestamp) << " ms." << endl;
      }

      return 0;
   }


also i somehow included winspool.h instead of winsock2.h.. i was wondering why my compiler was complaining about printing ****
Image
cyclobs

User avatar
Forgotten What The Sky Looks Like
 
Offline
Posts: 2437
Joined: 9 Feb 08, 7:16 pm
Location: Narrabri

Re: Fleeting/Random/Thoughts

Unread postby revengous » 27 Apr 12, 11:00 am

new hair stuff...always interesting

THIS ONE SMELLS LEIK VANILLA.
revengous

User avatar
Forgotten What The Sky Looks Like
 
Offline
Posts: 2049
Joined: 13 May 10, 4:42 pm
Location: Eating your pants.

Re: Fleeting/Random/Thoughts

Unread postby CelticAngel82 » 27 Apr 12, 11:08 am

Ruby is a ****. I am not enjoying programming.
your face, needs moar face.
CelticAngel82

User avatar
Story Teller
 
Offline
Posts: 1681
Joined: 1 Sep 05, 5:42 pm
Location: Cairns

Re: Fleeting/Random/Thoughts

Unread postby revengous » 27 Apr 12, 11:11 am

CelticAngel82 wrote:Ruby is a ****. I am not enjoying programming.

I didnt enjoy ruby all that much, stick with java if you can
revengous

User avatar
Forgotten What The Sky Looks Like
 
Offline
Posts: 2049
Joined: 13 May 10, 4:42 pm
Location: Eating your pants.

Re: Fleeting/Random/Thoughts

Unread postby cyclobs » 27 Apr 12, 11:14 am

i don't mind C++. still got tons and tons of stuff to learn, What I'm doing here i only have baseline understanding of it.
Image
cyclobs

User avatar
Forgotten What The Sky Looks Like
 
Offline
Posts: 2437
Joined: 9 Feb 08, 7:16 pm
Location: Narrabri

Re: Fleeting/Random/Thoughts

Unread postby CelticAngel82 » 27 Apr 12, 11:28 am

our tafe makes us use ruby.
everyone uses ruby. she's so easy to stick objects into.
your face, needs moar face.
CelticAngel82

User avatar
Story Teller
 
Offline
Posts: 1681
Joined: 1 Sep 05, 5:42 pm
Location: Cairns

Re: Fleeting/Random/Thoughts

Unread postby cyclobs » 27 Apr 12, 11:32 am

wee it compiled! .. after needing to do something in MSVS :evil:

edit: and my program crashes >.<



later edit: (since people whinge about double posting) Finally got my witcher CD :D it's awesome, DD's don't compete with an awesome hard cover
Image
cyclobs

User avatar
Forgotten What The Sky Looks Like
 
Offline
Posts: 2437
Joined: 9 Feb 08, 7:16 pm
Location: Narrabri

Re: Fleeting/Random/Thoughts

Unread postby Helelix » 27 Apr 12, 1:43 pm

Heh, currently programming an Android app for uni (its in java btw). I gotta say, its easy until you get to an error which doesn't trace back to your code but to a random android library. Hopefully I can finish by 7 and catch the Avengers with everyone tonight....
Image
Helelix

User avatar
Padawan
 
Offline
Posts: 494
Joined: 1 Mar 10, 1:44 pm
Location: Adelaide

Re: Fleeting/Random/Thoughts

Unread postby cyclobs » 27 Apr 12, 2:17 pm

ha! try fixing a problem.. that seems to magically go away when you force it to echo the trouble some variable before being passed into an function :?

if you don't echo before being passed the program crashes on the first instances of using the variable. but print it on screen before being passed and it works fine..

wtf
Image
cyclobs

User avatar
Forgotten What The Sky Looks Like
 
Offline
Posts: 2437
Joined: 9 Feb 08, 7:16 pm
Location: Narrabri

Re: Fleeting/Random/Thoughts

Unread postby CelticAngel82 » 27 Apr 12, 2:22 pm

what a great day so far... walked down to pick up my mystery parcel at the post.. found out it's 2 more free books from Penguin :D (Large parcel yesterday contained 3 free PEnguin books).. dusted off the Wii and played some guitar hero 5 and guitar hero metallica.. some super mario smash bros.. good times, good times...
then for much of the remainder i've been laying here on the couch with a large Toblerone, some Coke and one of my new books :D Even the cat has been relaxing with me :D
Headache is still there but it feels great not doing anything.
your face, needs moar face.
CelticAngel82

User avatar
Story Teller
 
Offline
Posts: 1681
Joined: 1 Sep 05, 5:42 pm
Location: Cairns

PreviousNext

Return to The Water Cooler

Who is online

Users browsing this forum: No registered users and 5 guests

x

#{title}

#{text}