Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

jamal

@jamal
About
Posts
13
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Linux Threads, UDP packet checking and timer
    J jamal

    Hi all... I have a server program that receives and sends UDP packets. Everytime there is UDP packet from a client, my server program will check the command and respond first with acknowledgement command and then followed by the real responds. Everytime server send a package, the packet will be put on packet checking queue which store its time of sending and no. of sending. So if more than 10 second I don't get any ack, I will send again the same package , set the time of sending and increment the no. of sending. After 3 times trying without any client respond then I will set user status as 'disconnected' or something like that. Here is the code snippet : void packetCheckThread(void *arg) { .... while(1) { pthread_mutex_lock(&sendList.mtx); while(sendList.noQueue == 0) pthread_cond_wait(&sendList.cond, &sendList.mtx); top = sendList.queue; info = top->info; pthread_mutex_unlock(&sendList.mtx); diff = 0; // Check the send time for (head) if (top != NULL && bValid) { diff = GetDiffTime(info.sendTime) ; if (diff > 10) { // if time out // Delete the item from list and return the list item ... if (cInfo.noSend < 3) { Trace("Resend packet again"); } } } } } note: - GetDiffTime() call time() to ask for the current time and find the difference with info.sendTime.. - packet queue structure: typedef struct { char ip[IPLEN]; // user's ip int port; // user's port char packetID[IPLEN]; // packet ID int dLen; // length of data char *pData; // Data int sendTime; // send time in unix format int noSend; // no of sending char etc[IPLEN]; // additional information, see packet.h } TSendInfo; Problems: 1. Why sometimes my program resending the packet less than 10 seconds interval, sometimes after only for 3 seconds. Does time() return the correct time? or is it thread safe? 2. I notice this thread checking function require a lot of CPu times since it is looping all the time if the checking queue is not empty. How to reduce this CPU time? 3. Currently I don't set any thread priorities but I want to make this packet checking thread run in the lowest priorities which

    IT & Infrastructure css sysadmin linux data-structures debugging

  • Free drive space sites?
    J jamal

    Anybody knows URL sites for storing file internet for free? My friends want to send me file 9 MB using MSN or yahoo messenger but he can't transfer the file succesfully after tried it several times. I am thinking if he can store the file in some free space site and I can retrieve it later. jamal

    The Lounge question

  • KDE v's GNOME
    J jamal

    I mostly use KDE for better integration between the apps and for programmming reason. KDE bases on Qt toolkit, a C++ library and it has a powerful free IDE called KDevelop. My favourite apps in KDE is Konqueror and KOffice. I install version 2.2 and it is very nice . jamal

    The Lounge discussion perl linux tools question

  • 1984
    J jamal

    I always thought facial recognition technology is still in very primitive form. I mean the advance in this technology for the last couple of years is not very great compare to other part of computer technology. Obviously it is not like in some holywood movie where any man face can be analyze and matched with stored data, but if this technology is already exist and mature, then I can imagine it will take so much budget to employee this technology across part of United state.

    The Lounge security question learning

  • message to osama..
    J jamal

    I found this message to osama bin laden on eBay. Unfortunately he can't see this. There is no internet in Afghanistan. ;P :-D

    The Lounge com question

  • streaming server
    J jamal

    Hi, i just wonder if there are examples or documentation on the net how to build a streaming server for movie or sound. I couldn't found any resources on the net.

    The Lounge sysadmin tutorial

  • What's going on with book prices
    J jamal

    I guess probably it is because of australian GST :) But seriously, when I was in australia I bought some teechnical books and they cost almost the same as the original quoted price in USD. It was around 1995-1998. And also from my experience, It was better to buy books on campus bookstore, because there is discount even for non student and they have book sale. I once found "Programming Windows 95" by Petzold in an australian campus bookstore for $ASD 10.00, which is far a lot cheaper than the original price at $USD 49.95.

    The Lounge com json question learning

  • CodeProject is now running .NET beta 2
    J jamal

    Few days ago I find sometimes codeproject site was really slow. But, I notice that the page downloading is really fast now. Is it JUST because of these change? Wow...

    The Lounge csharp sysadmin beta-testing

  • QT toolkit for windows
    J jamal

    Hi... Probably you guys wanna try QT toolkit for win32. QT is C++ library for building multi platform application (see http://www.trolltech.com). It is based library for building KDE Linux Desktop environment (kde.org) But, this Qt for win32 is free downloadable for building Non-commercial windows applications. Here is the link: http://www.trolltech.com/products/download/freelicense/noncommercial-dl.html

    The Lounge c++ html com linux workspace

  • Bugs in Ms Word
    J jamal

    I don't even know it is an easter egg. I am using Korean version of Microsoft window since I don't have the english version.

    The Lounge help

  • Bugs in Ms Word
    J jamal

    There is a bug in Ms Word 2000 (probably you guys is already familiar with this bug ) which is very strange to me. Try this : 1) open a new word document 2) type "= rand (200,99)" (without " ") 3) press enter and wait for 3 seconds :confused:

    The Lounge help

  • Question about GetDlgItem()
    J jamal

    Thanks Chris for the link. It is very helpful. Codeproject is a great site and keep up the good work.

    The Lounge question c++ learning

  • Question about GetDlgItem()
    J jamal

    Hi, I am reading jeff Prosise Book, "Programming Windows With MFC", I have a question regarding GetDlgItem() Function To obtain control pointer. In page 403, Jeff states that it is poor programming practice and dangerous at the same time to use statement like this: CListBox* pList= (CListBox*) GetDlgItem(IDC_LIST); I have seen many examples code that they are using this statement to obtain the pointer. Unfortunately, Jeff didn't explain why it is dangerous to use it. Anybody can explain to me why?

    The Lounge question c++ learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups