Search Results

Search found 4015 results on 161 pages for 'packet capture'.

Page 2/161 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • SharpPcap - A Packet Capture retring seding messesge problem.

    - by Eyla
    I trying to capture packets using SharpPcap library. I'm able to return the packets details but I'm having problem to get what the message content inside the packet. the packet using .Data to return the message and when I use it it is returning (System.Byte[]). here is the library website: http://www.codeproject.com/KB/IP/sharppcap.aspx here is my code: string packetData; private void packetCapturingThreadMethod() { Packet packet = null; int countOfPacketCaptures = 0; while ((packet = device.GetNextPacket()) != null) { packet = device.GetNextPacket(); if (packet is TCPPacket) { TCPPacket tcp = (TCPPacket)packet; myPacket tempPacket = new myPacket(); tempPacket.packetType = "TCP"; tempPacket.sourceAddress = Convert.ToString(tcp.SourceAddress); tempPacket.destinationAddress = Convert.ToString(tcp.DestinationAddress); tempPacket.sourcePort = Convert.ToString(tcp.SourcePort); tempPacket.destinationPort = Convert.ToString(tcp.DestinationPort); tempPacket.packetMessage = Convert.ToString(tcp.Data); packetsList.Add(tempPacket); packetData = "Type= TCP" + " Source Address = "+ Convert.ToString(tcp.SourceAddress)+ " Destination Address =" +Convert.ToString(tcp.DestinationAddress)+ " SourcePort =" + Convert.ToString(tcp.SourcePort)+ " SourcePort =" +Convert.ToString(tcp.DestinationPort)+ " Messeage =" + Convert.ToString(tcp.Data); txtpackets.Invoke(new UpdatetxtpacketsCallback(this.Updatetxtpackets), new object[] { packetData }); string[] row = { packetsList[countOfPacketCaptures].packetType, packetsList[countOfPacketCaptures].sourceAddress, packetsList[countOfPacketCaptures].destinationAddress, packetsList[countOfPacketCaptures].sourcePort, packetsList[countOfPacketCaptures].destinationPort, packetsList[countOfPacketCaptures].packetMessage }; try { //dgwPacketInfo.Rows.Add(row); countOfPacketCaptures++; //lblCapturesLabels.Text = Convert.ToString(countOfPacketCaptures); } catch (Exception e) { } } else if (packet is UDPPacket) { UDPPacket udp = (UDPPacket)packet; myPacket tempPacket = new myPacket(); tempPacket.packetType = "UDP"; tempPacket.sourceAddress = Convert.ToString(udp.SourceAddress); tempPacket.destinationAddress = Convert.ToString(udp.DestinationAddress); tempPacket.sourcePort = Convert.ToString(udp.SourcePort); tempPacket.destinationPort = Convert.ToString(udp.DestinationPort); tempPacket.packetMessage = udp.Data.ToArray() + "\n"; packetsList.Add(tempPacket); packetData = "Type= UDP" + " Source Address = "+ Convert.ToString(udp.SourceAddress)+ " Destination Address =" +Convert.ToString(udp.DestinationAddress)+ " SourcePort =" + Convert.ToString(udp.SourcePort)+ " SourcePort =" +Convert.ToString(udp.DestinationPort)+ " Messeage =" + udp.Data.ToArray() + "\n"; string[] row = { packetsList[countOfPacketCaptures].packetType, packetsList[countOfPacketCaptures].sourceAddress, packetsList[countOfPacketCaptures].destinationAddress, packetsList[countOfPacketCaptures].sourcePort, packetsList[countOfPacketCaptures].destinationPort, packetsList[countOfPacketCaptures].packetMessage }; try { //dgwPacketInfo.Rows.Add(row); //countOfPacketCaptures++; //lblCapturesLabels.Text = Convert.ToString(countOfPacketCaptures); txtpackets.Invoke(new UpdatetxtpacketsCallback(this.Updatetxtpackets), new object[] { packetData }); } catch (Exception e) { } } } }

    Read the article

  • SharpPcap - A Packet Capture getting messesge problem.

    - by Eyla
    I trying to capture packets using SharpPcap library. I'm able to return the packets details but I'm having problem to get what the message content inside the packet. the packet using .Data to return the message and when I use it it is returning (System.Byte[]). here is the library website: http://www.codeproject.com/KB/IP/sharppcap.aspx here is my code: string packetData; private void packetCapturingThreadMethod() { Packet packet = null; int countOfPacketCaptures = 0; while ((packet = device.GetNextPacket()) != null) { packet = device.GetNextPacket(); if (packet is TCPPacket) { TCPPacket tcp = (TCPPacket)packet; myPacket tempPacket = new myPacket(); tempPacket.packetType = "TCP"; tempPacket.sourceAddress = Convert.ToString(tcp.SourceAddress); tempPacket.destinationAddress = Convert.ToString(tcp.DestinationAddress); tempPacket.sourcePort = Convert.ToString(tcp.SourcePort); tempPacket.destinationPort = Convert.ToString(tcp.DestinationPort); tempPacket.packetMessage = Convert.ToString(tcp.Data); packetsList.Add(tempPacket); packetData = "Type= TCP" + " Source Address = "+ Convert.ToString(tcp.SourceAddress)+ " Destination Address =" +Convert.ToString(tcp.DestinationAddress)+ " SourcePort =" + Convert.ToString(tcp.SourcePort)+ " SourcePort =" +Convert.ToString(tcp.DestinationPort)+ " Messeage =" + Convert.ToString(tcp.Data); txtpackets.Invoke(new UpdatetxtpacketsCallback(this.Updatetxtpackets), new object[] { packetData }); string[] row = { packetsList[countOfPacketCaptures].packetType, packetsList[countOfPacketCaptures].sourceAddress, packetsList[countOfPacketCaptures].destinationAddress, packetsList[countOfPacketCaptures].sourcePort, packetsList[countOfPacketCaptures].destinationPort, packetsList[countOfPacketCaptures].packetMessage }; try { //dgwPacketInfo.Rows.Add(row); countOfPacketCaptures++; //lblCapturesLabels.Text = Convert.ToString(countOfPacketCaptures); } catch (Exception e) { } } else if (packet is UDPPacket) { UDPPacket udp = (UDPPacket)packet; myPacket tempPacket = new myPacket(); tempPacket.packetType = "UDP"; tempPacket.sourceAddress = Convert.ToString(udp.SourceAddress); tempPacket.destinationAddress = Convert.ToString(udp.DestinationAddress); tempPacket.sourcePort = Convert.ToString(udp.SourcePort); tempPacket.destinationPort = Convert.ToString(udp.DestinationPort); tempPacket.packetMessage = udp.Data.ToArray() + "\n"; packetsList.Add(tempPacket); packetData = "Type= UDP" + " Source Address = "+ Convert.ToString(udp.SourceAddress)+ " Destination Address =" +Convert.ToString(udp.DestinationAddress)+ " SourcePort =" + Convert.ToString(udp.SourcePort)+ " SourcePort =" +Convert.ToString(udp.DestinationPort)+ " Messeage =" + udp.Data.ToArray() + "\n"; string[] row = { packetsList[countOfPacketCaptures].packetType, packetsList[countOfPacketCaptures].sourceAddress, packetsList[countOfPacketCaptures].destinationAddress, packetsList[countOfPacketCaptures].sourcePort, packetsList[countOfPacketCaptures].destinationPort, packetsList[countOfPacketCaptures].packetMessage }; try { //dgwPacketInfo.Rows.Add(row); //countOfPacketCaptures++; //lblCapturesLabels.Text = Convert.ToString(countOfPacketCaptures); txtpackets.Invoke(new UpdatetxtpacketsCallback(this.Updatetxtpackets), new object[] { packetData }); } catch (Exception e) { } } } }

    Read the article

  • Python and C++ Sockets converting packet data

    - by yeus
    First of all, to clarify my goal: There exist two programs written in C in our laboratory. I am working on a Proxy Server (bidirectional) for them (which will also mainpulate the data). And I want to write that proxy server in Python. It is important to know that I know close to nothing about these two programs, I only know the definition file of the packets. Now: assuming a packet definition in one of the C++ programs reads like this: unsigned char Packet[0x32]; // Packet[Length] int z=0; Packet[0]=0x00; // Spare Packet[1]=0x32; // Length Packet[2]=0x01; // Source Packet[3]=0x02; // Destination Packet[4]=0x01; // ID Packet[5]=0x00; // Spare for(z=0;z<=24;z+=8) { Packet[9-z/8]=((int)(720000+armcontrolpacket->dof0_rot*1000)/(int)pow((double)2,(double)z)); Packet[13-z/8]=((int)(720000+armcontrolpacket->dof0_speed*1000)/(int)pow((double)2,(double)z)); Packet[17-z/8]=((int)(720000+armcontrolpacket->dof1_rot*1000)/(int)pow((double)2,(double)z)); Packet[21-z/8]=((int)(720000+armcontrolpacket->dof1_speed*1000)/(int)pow((double)2,(double)z)); Packet[25-z/8]=((int)(720000+armcontrolpacket->dof2_rot*1000)/(int)pow((double)2,(double)z)); Packet[29-z/8]=((int)(720000+armcontrolpacket->dof2_speed*1000)/(int)pow((double)2,(double)z)); Packet[33-z/8]=((int)(720000+armcontrolpacket->dof3_rot*1000)/(int)pow((double)2,(double)z)); Packet[37-z/8]=((int)(720000+armcontrolpacket->dof3_speed*1000)/(int)pow((double)2,(double)z)); Packet[41-z/8]=((int)(720000+armcontrolpacket->dof4_rot*1000)/(int)pow((double)2,(double)z)); Packet[45-z/8]=((int)(720000+armcontrolpacket->dof4_speed*1000)/(int)pow((double)2,(double)z)); Packet[49-z/8]=((int)armcontrolpacket->timestamp/(int)pow(2.0,(double)z)); } if(SendPacket(sock,(char*)&Packet,sizeof(Packet))) return 1; return 0; What would be the easiest way to receive that data, convert it into a readable python format, manipulate them and send them forward to the receiver?

    Read the article

  • Software to capture 3d geometry?

    - by user712092
    Programs I found I found these programs to capture OpenGL 3D scene : 3D Ripper, OpenGL and D3D geometry capture, there are some solved problems with 3D Ripper GLIntercept captures OpenGL function calls OpenGL Extractor captures 3d geometry; should work as plugin for GLIntercept another tool to capture OpenGL 3D data EDIT: There is also HijackGL which changes how a scene is rendered so it probably can be used to capture geometry; it is backed up by a academic paper; it is just just a nice program, not related to what I want i think (or it would might be hard to change it to be for what I want, because it would require programming). 3D Ripper captures geometry, textures and shaders. OpenGL Extractor captures just geometry ... General questions about such programs What is Your experience with these programs? Which of these programs would You recommmend? Do You know other such programs? Were there any problems with them, or are there problems with them in general? Are there programs which work best overall, or is it specific to certain 3d applications? What I need to do? I am looking to program which can capture 3d geometry for study purposes. And also for a program to capture 3D animation (frames of 3d animation). I tried only 3D Ripper because application I try to capture data from is on Direct 3D. 3D Ripper works with at least Direct 3D 9, this application has Direct 3D 6. Are there applications which work with older version of Direct 3D? Thank You very much. :) (I was verbose in link names because I want them to be indexed better by search engines.)

    Read the article

  • Odd internet packet routing

    - by NachoChip
    I want to know is there anyway to explicitly control the packet routing. I try to connect my computer in HK from San Francisco. It is extremely slow and I use tracert to see what is going on. It seems the packet get routed from HK to Europe and then to New York and then to San Francisco. In US, I am using Astound Cable. Is there any suggestion I can force the packet to not go around the world before it reach my computer? Or it is all ISP dependent?

    Read the article

  • Software to capture the packets in an MPEG Transport Stream

    - by Crippledsmurf
    I have a DVB-T capture card and would like to capture the packets from the MPEG stream it receives so i can analyse them just for a bit of fun and learning I've googled and found a lot of converters and software to capture the video from these streams but very little in the area of capturing raw data from a stream. What software exists that can capture and dump the MPEG stream from a tuner?

    Read the article

  • few questions on packet sniffer/analyzer

    - by user37652
    I have few questions about packet sniffer. I'm using a zyxel p-600 series modem and a hub to distribute the internet connection. Can I use a packet sniffer here to determine if the user is downloading something? Can I determine if the user is downloading a file based on the modem alone.(The lights blink faster) Is there an application that I could use for the modem or the hub to limit or avoid direct downloads. Details: OS: Ubuntu 9.10 and Windows 7

    Read the article

  • Home ADSL Modem Dropping Packets?

    - by Cody
    I know this is supposed to be a "pro" forum, but I'm hoping someone can help since my ISP isn't doing much to try and fix things. My ISP has given me a DSL modem / Router combo - a ADB / Pirelli P.DG A2100N and I have a 4096 / 767 kbps connection. I use it purely as modem and router, and have the wireless AP feature turned off. I run it to a Ubiquiti Networks Toughswitch and use a Ubiquiti UAP as the wireless access point - although I've ran tests directly wired to the router with nothing else connected, and still see the same issues. I've been having issues where latency suddenly spikes from 8ms to google.com to 250+ if someone does anything on the internet. If I run a speedtest or something, I can see latencies above 3000ms. Regularly when downloading something, even if the speed is throttled to , it can get random drops to 0kbps every few seconds. Online gaming is impossible because I notice the sudden lag-outs in the connection, and video streams or VoIP drop out as well - it's not at all consistent. I managed to find the password to my modem and I don't think I see anything wrong with the settings - but I looked for the logs and found this: Jun 6 17:10:30 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:10:30 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:10:31 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:10:40 user warn kernel: __ratelimit: 63 callbacks suppressed Jun 6 17:10:40 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:10:40 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:10:40 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:10:40 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:10:40 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:10:40 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:22 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:23 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:24 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:24 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:24 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:24 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:24 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:25 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:25 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:25 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:29 user warn kernel: __ratelimit: 15 callbacks suppressed Jun 6 17:11:29 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:29 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:30 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:11:30 user warn kernel: nf_conntrack: table full, dropping packet. Jun 6 17:55:26 user warn kernel: bcmxtmcfg: OAM loopback response not received on VCC 1.1.3 Jun 6 17:55:27 user warn kernel: bcmxtmcfg: OAM loopback response not received on VCC 1.1.4 So, as I understand it, it appears the router is dropping packets? If that's the case, is there anything in the config that I can change? Or should I buy a new router, a new modem, or both?

    Read the article

  • capture login screen-not sucssecful

    - by yinon
    I'm using Ubuntu 12.04 . If more information is needed, please tell me. I Tried some guides to cature my login screen: How can I take a screenshot of the login screen? http://www.howtoforge.com/how-to-take-a-screenshot-of-your-login-screen I tried the first one, but after running: $ sudo bash /tmp/shot.sh >/tmp/shot.xwd I'm getting this: No protocol specified No protocol specified xwd unable to open display ':0' and i'm getting an xwd file in my tmp folder. running the other commands giving errors. tried the second one, after running: chvt 8; sleep 5; XAUTHORITY=/var/gdm/:0.Xauth DISPLAY=:0.0 import -window root /tmp/gdm-login-shot.png I got: No protocol specified No protocol specified import: unable to open X server ':0.0' @ error/import.c/ImportImageCommand/366 Many Thanks for helping (: EDIT to vine_user: here the output from the terminal-I cacked it from within the system while I'm looged in: ubuntu@PrecisePangolin:~$ echo 'sleep 5; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAYDISPLAY xwd -root' > /tmp/shot.sh ubuntu@PrecisePangolin:~$ sudo bash /tmp/shot.sh >/tmp/shot.xwd bash: /tmp/shot.xwd: Permission denied ubuntu@PrecisePangolin:~$ sudo su root@PrecisePangolin:/home/ubuntu# sudo bash /tmp/shot.sh >/tmp/shot.xwd No protocol specified No protocol specified xwd: unable to open display ':0' root@PrecisePangolin:/home/ubuntu# EDIT 2!: HERE IT IS!: just uploading-this uploadong site is better than other iuset to use (: :

    Read the article

  • Replay UDP Packet Capture

    - by inspectorG4dget
    I have a UDP packet capture which was streamed from Port1 on IP1 to Port2 on IP2 on network N1. I need to replay these packets on another network N2 from Port3 on IP3 to Port4 on IP4. I need to know what software to use in order to do this and how I would go about replaying these packets so that I can detect/capture them again in N2. So far, I've tried strictly replaying these packets using a program called Colasoft Packet Player, with little luck. I'd appreciate any help on this. Thank you in advance

    Read the article

  • Iptables mark incoming packet - vpn routing

    - by Tom
    I have connected my home to my workplace for out of house backup reasons through openvpn. The connection is working nicely. At work I have 5 fixed IP addresses. Now I would like to assign one of these IP addresses to be forwarded to my home machine. I have confirmed packet arrival at my home machine with tcpdump. The problem is that my default route at home is NOT the tun0 (naturally), but eth0 to my own ISP. So I created a separate routing table to route my tun0 packets back to where they belong, but do not how to mark the incoming packet which arrive through tun0 with iptables, so I can drive them back. I do not want any port restrictions, but only what comes from tun0 should leave through tun0 thanks tom

    Read the article

  • iptables drop packet by hex string match

    - by Flint
    I got this packet captured with tcpdump but I'm not sure how to use the --hex-string param to match the packet. Can someone show me how to do it? 11:18:26.614537 IP (tos 0x0, ttl 17, id 19245, offset 0, flags [DF], proto UDP (17), length 37) x.x.187.207.1234 > x.x.152.202.6543: [no cksum] UDP, length 9 0x0000: f46d 0425 b202 000a b853 22cc 0800 4500 .m.%.....S"...E. 0x0010: 0025 4b2d 4000 1111 0442 5ebe bbcf 6701 .%[email protected]^...g. 0x0020: 98ca 697d 6989 0011 0000 ffff ffff 5630 ..i}i.........V0 0x0030: 3230 3300 0000 0000 0000 0000 203.........

    Read the article

  • HD Video Capture Card w/ Good API?

    - by Sheep Slapper
    Does anyone here know of a good HD video capture card that has a good (comprehensive) API? I administer a few servers that do some video encoding right now, but when we make the switch to HD cameras, they won't be sufficient. In addition to this, the servers we have now are black boxes, closed to me except to start/stop the video capture device. I'd like to be able to roll my own, so we can better integrate it with our existing systems, but I know almost nothing about what kind of HD capture cards are out there, and if I can avoid spending money just to test their APIs that would rock. So does anyone have any experience with this? All our other software is in C#, and I'd like to set up the new servers with web interfaces to start/stop the capture (also in C#, using .NET 3.5 probably). I'm not sure how language specific these APIs would be, but that's what I'm working with just as a reference point. I appreciate any help the community can give!

    Read the article

  • Capture traffic from SPAN and send it to a HyperV VM

    - by Josh Brower
    On a Server 2008 SP2 HyperV VM, I am trying to capture traffic from a SPAN. I know the SPAN is working, as I am able to capture the traffic on the Host OS, but when I try and capture traffic on the VM, with the SPAN being sent to a virtual adapter, I cannot seem to get it to work-- After doing some Googling, I have found that it might be because HyperV NICs cannot be put into promiscuous mode. (?) Any other thoughts? -Josh

    Read the article

  • Simple Image Capture Tool for Mac OS X that uses FireWire

    - by Justin Dearing
    I have Leopard (Mac OS X 10.5) on a G4 Powerbook and a camcorder with a firewire device. It doesn't have iMovie, which is now part of the separate iLife Suite and requires an Intel Mac. Anyway, Image Capture does not recognize the firewire video feed as an image capture device. What software would give me the simplest "capture this frame from live firewire video feed to image" functionality.

    Read the article

  • Recommendations for screen-capture tool that retains menus and mouse pointer

    - by Chris Farmer
    There are several screen capture tool questions already on this site, but I think I have a slight tweak to the usual. I'd like a handy screen capture utility that can: Run in Windows 7 Capture a sub-region of the screen Show the current state of the mouse cursor and any active menus I'd like to use it for writing docs that refer to specific application menu items. I like the built-in snipping tool in Windows 7, but the act of using it dismisses my menus, and it doesn't get the mouse cursor either. Do any such tools exist? EDIT: Ahh, I wasn't familiar with the "delayed capture" options of these tools, but they all seem to fit the bill. Thanks!

    Read the article

  • Automated capturing of screen using "Microsoft Expression Encoder Screen Capture" command line operations

    - by gentlesea
    I want to capture screen output automatically from within my TestComplete test program. For this i found the free limited version of "Microsoft Expression Encoder Screen Capture" which I want to automate. Is there a separate command line interface for Microsoft Expression Encoder Screen Capture or do I have to use the command line interface for Expression Studio? I found this options: http://msdn.microsoft.com/en-us/library/cc294683.aspx. But before I dig deeper, I want to know if I am on the right way.

    Read the article

  • How can I capture a video with Windows 7

    - by user12029
    I am trying to capture a live video from my digital camera using Windows 7. Live Movie maker and Windows Movie maker 2.6 do not have "capture" menu item. Apparently, Windows Movie maker 2.1 has a "capture" menu item. However, I don't know how to download it on Windows 7. Any suggestion?

    Read the article

  • Capture screen with fixed region

    - by user62046
    I would like to know if there is a systematical way (software) to capture a fixed region on the screen, under Windows 7 or OS X. It must be accurate about the region. I always want to capture the region with left-top coordinate (300, 300) and right-bottome coordinate (800, 800). So I can't not select the region by mouse myself. A software to do this capture should let me to input the 2 coordinates.

    Read the article

  • Any screen capture software that captures webcam, microphone inputs too ?

    - by mohanr
    I am going to conduct a user study. Apart from capturing the screen while the user is interacting with the system, I also want to capture the video/audio of the user. Is there any software that in addition to capturing the screen also overlays it with the webcam/microphone inputs. The goal is to capture the complete experience of the user: key/mouse interactions with the system along with their facial/vocal responses. I know that I can maybe run a screen-capture software and also run a software for capturing webcam audio/video alongside and try to sync/overlay both these streams with timestamps. But I am going to be dealing with probably several hundred hours of data. So I am looking for a tool that can streamline the process for me amap and help me keep my sanity at end of the process. Thanks,

    Read the article

  • Packet sniffing a webserver

    - by Shawn Mclean
    I have a homework in which I should explain how I would break into a server, retrieve a file and cover my tracks. My main question: is there a way to packet sniff a remote web server? Other information would be appreciated on covering tracks.

    Read the article

  • Library like ENet, but for TCP?

    - by Milo
    I'm not looking to use boost::asio, it is overly complex for my needs. I'm building a game that is cross platform, for desktop, iPhone and Android. I found a library called ENet which is pretty much what I need, but it uses UDP which does not seem to support encryption and a few other things. Given that the game is an event driven card game, TCP seems like the right fit. However, all I have found is WINSOCK / berkley sockets and bost::asio. Here is a sample client server application with ENet: #include <enet/enet.h> #include <stdlib.h> #include <string> #include <iostream> class Host { ENetAddress address; ENetHost * server; ENetHost* client; ENetEvent event; public: Host() :server(NULL) { enet_initialize(); setupServer(); } void setupServer() { if(server) { enet_host_destroy(server); server = NULL; } address.host = ENET_HOST_ANY; /* Bind the server to port 1234. */ address.port = 1721; server = enet_host_create (& address /* the address to bind the server host to */, 32 /* allow up to 32 clients and/or outgoing connections */, 2 /* allow up to 2 channels to be used, 0 and 1 */, 0 /* assume any amount of incoming bandwidth */, 0 /* assume any amount of outgoing bandwidth */); } void daLoop() { while(true) { /* Wait up to 1000 milliseconds for an event. */ while (enet_host_service (server, & event, 5000) > 0) { ENetPacket * packet; switch (event.type) { case ENET_EVENT_TYPE_CONNECT: printf ("A new client connected from %x:%u.\n", event.peer -> address.host, event.peer -> address.port); /* Store any relevant client information here. */ event.peer -> data = "Client information"; /* Create a reliable packet of size 7 containing "packet\0" */ packet = enet_packet_create ("packet", strlen ("packet") + 1, ENET_PACKET_FLAG_RELIABLE); /* Extend the packet so and append the string "foo", so it now */ /* contains "packetfoo\0" */ enet_packet_resize (packet, strlen ("packetfoo") + 1); strcpy ((char*)& packet -> data [strlen ("packet")], "foo"); /* Send the packet to the peer over channel id 0. */ /* One could also broadcast the packet by */ /* enet_host_broadcast (host, 0, packet); */ enet_peer_send (event.peer, 0, packet); /* One could just use enet_host_service() instead. */ enet_host_flush (server); break; case ENET_EVENT_TYPE_RECEIVE: printf ("A packet of length %u containing %s was received from %s on channel %u.\n", event.packet -> dataLength, event.packet -> data, event.peer -> data, event.channelID); /* Clean up the packet now that we're done using it. */ enet_packet_destroy (event.packet); break; case ENET_EVENT_TYPE_DISCONNECT: printf ("%s disconected.\n", event.peer -> data); /* Reset the peer's client information. */ event.peer -> data = NULL; } } } } ~Host() { if(server) { enet_host_destroy(server); server = NULL; } atexit (enet_deinitialize); } }; class Client { ENetAddress address; ENetEvent event; ENetPeer *peer; ENetHost* client; public: Client() :peer(NULL) { enet_initialize(); setupPeer(); } void setupPeer() { client = enet_host_create (NULL /* create a client host */, 1 /* only allow 1 outgoing connection */, 2 /* allow up 2 channels to be used, 0 and 1 */, 57600 / 8 /* 56K modem with 56 Kbps downstream bandwidth */, 14400 / 8 /* 56K modem with 14 Kbps upstream bandwidth */); if (client == NULL) { fprintf (stderr, "An error occurred while trying to create an ENet client host.\n"); exit (EXIT_FAILURE); } /* Connect to some.server.net:1234. */ enet_address_set_host (& address, "192.168.2.13"); address.port = 1721; /* Initiate the connection, allocating the two channels 0 and 1. */ peer = enet_host_connect (client, & address, 2, 0); if (peer == NULL) { fprintf (stderr, "No available peers for initiating an ENet connection.\n"); exit (EXIT_FAILURE); } /* Wait up to 5 seconds for the connection attempt to succeed. */ if (enet_host_service (client, & event, 20000) > 0 && event.type == ENET_EVENT_TYPE_CONNECT) { std::cout << "Connection to some.server.net:1234 succeeded." << std::endl; } else { /* Either the 5 seconds are up or a disconnect event was */ /* received. Reset the peer in the event the 5 seconds */ /* had run out without any significant event. */ enet_peer_reset (peer); puts ("Connection to some.server.net:1234 failed."); } } void daLoop() { ENetPacket* packet; /* Create a reliable packet of size 7 containing "packet\0" */ packet = enet_packet_create ("backet", strlen ("backet") + 1, ENET_PACKET_FLAG_RELIABLE); /* Extend the packet so and append the string "foo", so it now */ /* contains "packetfoo\0" */ enet_packet_resize (packet, strlen ("backetfoo") + 1); strcpy ((char*)& packet -> data [strlen ("backet")], "foo"); /* Send the packet to the peer over channel id 0. */ /* One could also broadcast the packet by */ /* enet_host_broadcast (host, 0, packet); */ enet_peer_send (event.peer, 0, packet); /* One could just use enet_host_service() instead. */ enet_host_flush (client); while(true) { /* Wait up to 1000 milliseconds for an event. */ while (enet_host_service (client, & event, 1000) > 0) { ENetPacket * packet; switch (event.type) { case ENET_EVENT_TYPE_RECEIVE: printf ("A packet of length %u containing %s was received from %s on channel %u.\n", event.packet -> dataLength, event.packet -> data, event.peer -> data, event.channelID); /* Clean up the packet now that we're done using it. */ enet_packet_destroy (event.packet); break; } } } } ~Client() { atexit (enet_deinitialize); } }; int main() { std::string a; std::cin >> a; if(a == "host") { Host host; host.daLoop(); } else { Client c; c.daLoop(); } return 0; } I looked at some socket tutorials and they seemed a bit too low level. I just need something that abstracts away the platform (eg, no WINSOCKS) and that has basic ability to keep track of connected clients and send them messages. Thanks

    Read the article

  • Join Us for the Next Quarterly Customer Update Webcast

    - by michelle.huff
    Join us for the next Oracle Content Management Quarterly Customer Update Webcast scheduled for this coming January 19 & 20, 2010. In this webcast we'll bring you up to speed on the latest updates and changes made available these past few months. Additionally, we'll cover the new features and certifications in the latest ODC & ODDC 10.1.3.5.1 release, as well as the upcoming Enterprise Content Management Suite 11gR1 PS3 (patch set 3) release. Register Today! Americas / EMEA time zones: Customer Update January 19, 2010 9:00am US PT / 12:00pm US ET / 17:00 London Length: 1 hour *Please use your corporate email address to register. Asia-Pacific time zones: Customer Update (Repeat Webcast) January 20, 2010 1:00pm Sydney AET, 10:00am Singapore (Jan 19, 2010 @ 6:00pm US PT) Length: 1 hour *Please use your corporate email address to register Missed Previous Customer Quarterly Updates? Get caught up on Oracle & ECM news. View a recording or the presentation from previous Webcasts held since June 2008 (available from My Oracle Support).

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >