Sunday, December 29, 2019

Implementing PING Without Using Raw Sockets

Windows supports an Internet Control Message Protocol (ICMP) to determine whether or not a particular host is available.  ICMP is a network layer protocol that delivers flow control, error messages, routing, and other data between Internet hosts. ICMP is primarily used by application developers for a network ping. What Is a Ping? A ping is the process of sending an echo message to an IP address and reading the reply to verify a connection between TCP/IP hosts. If you are writing a new application, you will be better to use the Winsock 2 raw sockets support, implemented in  Indy, for example. Please note, however, that for Windows NT and Windows 2000 implementations, Raw Sockets are subject to security checks and are accessible only to members of the administrators group. Icmp.dll provides functionality that allows developers to write Internet ping applications on Windows systems without Winsock 2 support.   Note that the Winsock 1.1 WSAStartup function must be called prior to using the functions exposed by ICMP.DLL. If you do not do this, the first call to IcmpSendEcho will fail with error 10091 (WSASYSNOTREADY). Below you can find the Ping units source code. Here are two examples of usage. Example 1: Code Snippet uses Ping;...​const ADP_IP 208.185.127.40; (* http://delphi.about.com *)beginIf Ping.Ping(ADP_IP) then ShowMessage(About Delphi Programming reachable!);end; Example 2: Console Mode  Delphi Program Our next example is a console mode Delphi program  that uses the Ping unit:  . Heres  the Ping units source: unit Ping;​interfaceusesWindows, SysUtils, Classes;typeTSunB packed records_b1, s_b2, s_b3, s_b4: byte;end;TSunW packed records_w1, s_w2: word;end;PIPAddr ^TIPAddr;TIPAddr recordcase integer of0: (S_un_b: TSunB);1: (S_un_w: TSunW);2: (S_addr: longword);end;IPAddr TIPAddr;function IcmpCreateFile : THandle; stdcall; external icmp.dll;function IcmpCloseHandle (icmpHandle : THandle) : boolean;stdcall; external icmp.dllfunction IcmpSendEcho(IcmpHandle : THandle; DestinationAddress : IPAddr;RequestData : Pointer; RequestSize : Smallint;RequestOptions : pointer;ReplyBuffer : Pointer;ReplySize : DWORD;Timeout : DWORD) : DWORD; stdcall; external icmp.dll;function Ping(InetAddress : string) : boolean;implementationusesWinSock;function Fetch(var AInput: string;const ADelim: string ;const ADelete: Boolean true): string;variPos: Integer;beginif ADelim #0 then begin// AnsiPos does not work with #0iPos : Pos(ADelim, AInput);end else beginiPos : Pos(ADelim, AInput);end;if iPos 0 the n beginResult : AInput;if ADelete then beginAInput : ;end;end else beginresult : Copy(AInput, 1, iPos - 1);if ADelete then beginDelete(AInput, 1, iPos Length(ADelim) - 1);end;end;end;procedure TranslateStringToTInAddr(AIP: string; var AInAddr);varphe: PHostEnt;pac: PChar;GInitData: TWSAData;beginWSAStartup($101, GInitData);tryphe : GetHostByName(PChar(AIP));if Assigned(phe) thenbeginpac : phe^.h_addr_list^;if Assigned(pac) thenbeginwith TIPAddr(AInAddr).S_un_b do begins_b1 : Byte(pac[0]);s_b2 : Byte(pac[1]);s_b3 : Byte(pac[2]);s_b4 : Byte(pac[3]);end;endelsebeginraise Exception.Create(Error getting IP from HostName);end;endelsebeginraise Exception.Create(Error getting HostName);end;exceptFillChar(AInAddr, SizeOf(AInAddr), #0);end;WSACleanup;end;function Ping(InetAddress : string) : boolean;varHandle : THandle;InAddr : IPAddr;DW : DWORD;rep : array[1..128] of byte;beginresult : false;Handle : IcmpCreateFile;if Handle INVALID_HANDLE_VALUE thenExit;TranslateStringToTInAddr(InetAddres s, InAddr);DW : IcmpSendEcho(Handle, InAddr, nil, 0, nil, rep, 128, 0);Result : (DW 0);IcmpCloseHandle(Handle);end;​end.

Saturday, December 21, 2019

Bussines Decision Methods Essay - 1044 Words

INGRID B. TAGAL PROFESSOR JEH-NAN PAN DECEMBER 2008 BUSINESS DECISION METHODS ESSAY Fall semester ended. Now, its time to evaluate myself and think of the things that I learned the whole semester. Honestly, I did learn a lot of things in all my subjects. I felt like a sponge, absorbing all the knowledge I could possibly have. For Business Decision Methods, I met a lot of acquaintances and stranger, I should say. Before I came into the class, 1was not so clear of what to expect about it. But not so long, the professor started orienting u.sxzii%e_topiaat will be lectured the whole semester. I realized that BDM, is not really Greek to me. In fact, I met old acquaintances such as Mr. M e Mrs. Me*, Ms. Minzmax, and the†¦show more content†¦Linear programming aids you in identifying whether, for example, two alternatives would yield a higher profit if mixed or not, and if it should be mixed, what proportions would be adequate or could optimized the payoff. Similarly, costs can also be minimized at an optimum level using this method. This is very important for decision making in Finance, as this will help you arrive at the most efficient and effective solution for the problem. Wow! I did learn a lot this semester. And I know that the knowledge I acquired fiom this subject would help me in facing endeavours or circumstances in the future. I am now equipped with the knowledge of Business Decision Methods. I cant believe that the fall semester ended already, it seems and it felt like it was not 5 months ago when I first arrived here in NCKU. Just like the old cliche, .Time runs fast, I would say. It . might sound dramatic for me to end this essay like this; but truthfully, within the 5 months stay here in NCKU, I did learned a lot and treasured a lot. And I ~ w e i ~ - a l l _ t p P m y Y ~ ~ f e s S ~ ~ ~ t g NCKU, as a whole. Professor, I want to express m heartfe~atitude-t0-y~u,to IA@A y the department, and to NCKU for granting me the privilege, which I am_ueq+beased to have, to _ a / - study in this w e l m - n . Professor, I am most g r a t f o r v ~ u ~ @ f and k n o w l e d . . Though your schedules are hectic, you still devoted time and

Friday, December 13, 2019

The Secret Circle The Divide Chapter 17 Free Essays

The group cruised along the picturesque coastline of the New Salem waterfront until they reached the docks where Scarlett worked. On the way, Diana had taken Cassie aside and thanked her for coming with them. She said she felt bad about going against Cassie’s wishes, but insisted it was for the safety of the group as a whole. We will write a custom essay sample on The Secret Circle: The Divide Chapter 17 or any similar topic only for you Order Now Cassie forced herself to sound agreeable and said she understood. What use was it bumping heads with Diana now? And besides, like Nick said, this encounter might prove once and for all that Scarlett was just a regular girl with no intentions of harming the Circle. Then Cassie would be free to be her friend. Overhearing Cassie and Diana’s apparent truce, Adam took Cassie’s hand in his. He was still holding it now as Diana addressed the group. â€Å"Are we all clear on the plan?† Diana asked. Her blonde hair shimmered in the sun, and she had the self-possession of a commander in chief. Deborah’s eyes gleamed with the desire for combat. â€Å"We draw her out, we circle her, and then we cast the witch-hunter curse.† â€Å"No,† Adam corrected Deborah. â€Å"We circle her, and we get all the facts.† â€Å"That’s right,† Diana said. â€Å"We should try to get as much information out of her before we cast the curse.† She information out of her before we cast the curse.† She paused. â€Å"Especially since we’re not entirely sure what’ll happen once we do.† Cassie couldn’t think about that part. The only way she would get through this was by continuing to believe in Scarlett. â€Å"There she is.† Laurel pointed to the side exit of the Oyster Bar. â€Å"She must be on a break.† â€Å"Perfect,† Faye said. It was plain to see that her blood was boiling with excitement. She charged ahead of the group, leading the way. Scarlett saw them coming almost immediately. Anyone in their right mind would have become alarmed at the sight of this angry mob of twelve approaching, but Scarlett smiled wide and started waving to them, heaving her skinny arm back and forth as if she needed to catch their attention. â€Å"She’s bluffing,† Faye said, as they continued their approach. â€Å"Don’t fall for it.† But Faye didn’t even have to say it. Not one of them faltered or fell out of step. Before Scarlett could even say â€Å"hello,† they had her surrounded. Finally she began to catch on that something peculiar was happening, that she was in trouble. â€Å"What’s going on?† she asked, turning, circling, trying to locate Cassie in the ring of heavy-breathing bodies around her. The scene couldn’t have gone down more smoothly. They were positioned on the side of the Oyster Bar, where it was desolate except for the occasional busboy going to the Dumpsters. Scarlett was trapped. No one would even hear her scream. her scream. Only Cassie could save her now. â€Å"Scarlett,† she said. â€Å"We need the truth from you, or else you’re going to get hurt. My friends think you had something to do with my car accident. I don’t believe that. But I need you to prove to them that you’re innocent.† Scarlett’s round, dark eyes softened. â€Å"Is that what this is about? Of course I had nothing to do with that.† â€Å"What about the lighthouse?† Diana’s voice was stern. It sounded more like a threat than a question. â€Å"What about it?† Scarlett asked. â€Å"You burned it to the ground,† Faye shouted. â€Å"I what?† Scarlett began to lose her cool. â€Å"Why would I do something like that?† Her survival instincts set in, and Cassie knew that it wasn’t far off now, the moment of truth. Adam narrowed in on her. â€Å"Who are you working with?† â€Å"At the Oyster Bar?† Scarlett was trembling now, like a cornered street cat poised to strike. â€Å"Answer the question,† Diana said. â€Å"Who are you working with?† â€Å"I don’t know what you’re talking about.† Scarlett cried out and ran for Cassie then, for help. The Circle moved in closer on her, blocking any exit. But Faye saw Scarlett’s rushing at Cassie as a direct threat and swiftly reacted. She raised her hands and called out, â€Å"By the power of this Circle, I call on Hecate!† Time slowed down for Cassie in that moment. She could see the shock on Scarlett’s face and the fury in Faye’s eyes. She could hear Diana screaming out, No, not yet! But Faye was unstoppable. She appeared to take on giant proportions the instant she called on Hecate, as if she embodied the form of the dark Goddess herself. She seemed to grow to seven feet tall, and her honey-colored eyes blackened like marbles. She cast the first part of the witch-hunter curse with the power of thunder. Curse this ancient hunter who aims to harm me Acts of evil now return threefold to thee! The sky above Faye’s outstretched hands reddened and spiraled into a violent funnel-like cloud. She harnessed it toward her, drew it in, and molded it with one swirl of her charmed fingertips into a ball of fire. As she tossed it from one hand to the other, the Circle chanted the Latin words they’d memorized – dark, unfathomable words they barely understood – until Faye heaved the firebal at Scarlett like a heavy stone. But Scarlett shocked them all. With one swift motion she caught the roiling fire in her hands and burst it between her palms. â€Å"Be it undone!† she called out, the classic defense spell. Within seconds, Faye shrunk back down to size and toppled over sideways onto the ground. The opening in the sky stitched itself closed, and the light of day returned to normal. â€Å"How do you know the defense spell?† Cassie asked. But even as the question left Cassie’s lips, she knew there could only be one explanation. Scarlett wasn’t a witch hunter. She was a witch, like them. Deborah and Suzan ran to Faye to see if she was okay. Slowly, they got Faye to her feet, but she appeared dazed and wobbly. Scarlett turned to Cassie. Her dark eyes were still enflamed from the spell. â€Å"I’m sorry you had to find out this way,† she said. Adam stepped forward, astonished. â€Å"You’re a witch?† Scarlett nodded and turned again to Cassie. â€Å"I wanted to tell you since the moment we first met.† â€Å"Why didn’t you?† Diana asked. â€Å"I was waiting for the right time,† Scarlett said. â€Å"You’re a witch?† Cassie asked, repeating Adam’s words and stunned tone verbatim. â€Å"Not just any witch.† Scarlett smiled shyly. â€Å"I’m your half sister.† â€Å"What?† Cassie could hardly breathe. â€Å"How?† â€Å"We have the same father,† she said. â€Å"Black John.† Scarlett observed the shock in each of their faces. â€Å"I came to this town trying to escape the witch hunters, just like you are now. Back home, we were discovered.† She turned to Diana, somehow understanding she was the Circle’s leader. â€Å"The hunters killed my mother,† she said. â€Å"And they marked me. I came here to get the protection of the Circle.† â€Å"So you knew about us,† Melanie said. â€Å"Yes.† Scarlett reached for Cassie and took both her hands in her own. â€Å"My mother grew up in this town. I knew I had a sister out here my entire life, and I wanted to meet her.† This was almost more than Cassie could bear. The whole world started to spin, and she thought she might actually be dreaming, but then Diana spoke up, loudly jolting her from her haze. â€Å"So Cassie was right all along,† she said. Diana put one slender hand on Cassie’s shoulder and the other on Scarlett’s. â€Å"Please accept my apology,† she said. â€Å"Our apology. To both of you. We should have had more faith.† â€Å"I accept,† Scarlett said, smiling. But Faye’s husky voice crashed the sentimental moment. Apparently, she’d regained her strength. â€Å"How do we know you’re not lying, Scarlett? What proof do you have for any of these claims?† Deborah answered for Scarlett, and for the group. â€Å"When she knocked you on your behind by deflecting your curse,† she said, â€Å"that was proof enough for me.† â€Å"Me too,† Suzan said, laughing. Faye smirked. â€Å"I mean about being Cassie’s half sister.† â€Å"She’s telling the truth,† Cassie said. â€Å"I think, deep down, I’ve known it all along.† Diana turned to Faye. â€Å"I think it’s time for us to trust Cassie on this. Obviously, her sight wasn’t clouded after all.† One by one, everyone expressed their apologies to Scarlett. Even Melanie, who’d wanted so badly to believe Scarlett had been the hunter responsible for killing her great-aunt Constance, put aside her desire for retribution and shook her hand. â€Å"We misjudged you,† Melanie said. â€Å"I’m sorry.† It was hardly enough, considering they’d just tried to kill her, but it was all anyone could say. The apologies were for Cassie, too. But Cassie didn’t need anyone’s apology – she had been right. She knew she felt connected to Scarlett, she just knew it! What a relief it was to have the truth come out at last. Adam appeared as relieved as she was. He went to Cassie and wrapped his arms around her. â€Å"I should have never doubted you,† he said. â€Å"That’s okay,† Cassie said. â€Å"You can remember that for next time.† She hugged Adam back and, as she did, she caught sight of Nick looking on. He was the only one who’d stuck with her when everyone else was so sure Scarlett was evil. She would have to remember to thank him later, when they had a moment alone together. How to cite The Secret Circle: The Divide Chapter 17, Essay examples