dev-cpp-users Mailing List for Dev-C++ (Page 41)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Xu B. <xb...@gm...> - 2007-12-10 02:46:38
|
Hi,anyone who can help me?When I compile any program,"[Linker Error] undefined reference to `__cpu_features_init' ld returned 1 exit status C:\Documents and Settings\Administrator\My Documents\Makefile.win [Build Error] exe: *** [Output/MingW/TestDlg.exe] Error 1 " occurs. Regards |
From: <ili...@at...> - 2007-12-10 01:45:50
|
I'm kinda new to Winsock programming. I downloaded some good tutorials that I can learn from, but I was wondering if anyone could tell me if I can send data to a server from a client using send() and how do I do it in Dev? Is there something that i have to do to get it to work? |
From: hhh h. <the...@ho...> - 2007-12-08 14:08:06
|
Check in MSDN ... There must me a Message to the main window when you click on it, prob a WM_UPDATE ou WM_PAINT something like that. The sollution for the button thing, is disabling it on its proprieties. Or hide the button with the apropriated function to Show windows, I believe its ShowWindow, with the sw_hide code. Hope this helps. Did o check out hook controls for the RS323 code? or, hmm, probably SetDeviceIO() function? Keep us posted _________________________________________________________________ Transfira JÁ a última versão do Windows Live Messenger! http://get.live.com/pt-pt/messenger/overview |
From: Thomas E. <tho...@ya...> - 2007-12-08 07:43:33
|
To whom it may concern I wish to remove my email off your server so that i don't revieve any emails. thank you Regards Thomas Edwards --------------------------------- Make the switch to the world's best email. Get the new Yahoo!7 Mail now. |
From: Chris M. <lor...@gm...> - 2007-12-07 22:24:20
|
Google for a book called "thinking in c," because it has a few algorithms I think would interest you. -- Registered Linux Addict #431495 http://profile.xfire.com/mrstalinman John 3:16! If Microsoft is the Wal*Mart of the Software World, then Linux is the Home Depot |
From: Jessica C. <jes...@gm...> - 2007-12-07 21:08:27
|
dialog box1 (DLG1) and dialog box2 (DLG2) can be popped up in front of main dialog box (IDD_MAIN). then I tried to make main dialog box (defined by IDD_MAIN) to the foreground by clicking on it. but it doesn't work. it stills as a background. what is the problem here? btw, DLG1 and DLG2 can shift to the foreground by clicking on them easily. my structure of code is as follows. WndProc() { switch(msg) { WM_COMMAND: ID_1: CreateDialog(g_hInst, "DLG1", hwnd, DlgProc1); break; ID_2: CreateDialog(g_hInst, "DLG1", hwnd, DlgProc1); break; } break; } WinMain() { CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_MAIN),NULL, WndProc); } |
From: Benson M. <ben...@gm...> - 2007-12-07 19:00:28
|
Hey,anyone who can help me sort a 2D array and get the mode of the most occuring elements..... e.g. array[256][256] and be able to get the mode.... am doing some image manipulations that need that... Regards |
From: Jessica C. <jes...@gm...> - 2007-12-07 18:11:41
|
i used CreateDialog to create a dialog box. CreateDialog can create dialog box without disturbing the applications running behind. but the problem is: after i push a button to trigger a dialog box opened, i can still push that button to trigger the dialog box opened again. but what i want to get is just 1 dialog box. i mean, after the dialog box is opened, then i cannot trigger the same dialog box by clicking the same button. i think the problem is from modeless/modal concept. what shall i solve this problem? |
From: Per W. <pw...@ia...> - 2007-12-07 12:24:53
|
Green text? In a text mail? Don't think so :) int size = 6; accept(xx,yy,&size); This sends the value 6 to accept, and the reason why it is sent as a pointer is that on call, it reports the size of your buffer, and on return it will inform how large the returned address actually was. But why the magic value 6? Never use numerical values randomly in the code. Why didn't you use sizeof() to make sure that the value 6 really matches the size of your buffer? /pwm On Thu, 6 Dec 2007, Ben Melikant wrote: > hello. I am trying to write that winsock app that i was working on the > other day. I want to find the IP address of the computer that is > connecting to the server. Here is the code for the server application: > > #include <winsock2.h> > #include <windows.h> > #include <iostream> > #include <fstream> > #include <string> > > using namespace std; > > int main () > { > WSADATA wsadat; > SOCKET Socket, TempSocket = SOCKET_ERROR; > SOCKADDR_IN SockAddr; > SOCKADDR ConnAddr; > ifstream infile; > string filename = "C:\\counter.java"; > char send_str[1], recv_str[6]; > int a = 0, in_char, RetVal; > > if (WSAStartup (MAKEWORD(1,1), &wsadat) != 0) > { > cout << "WSAStartup failed!!!"; > } > > Socket = socket(AF_INET, SOCK_STREAM, 0); > if (Socket == INVALID_SOCKET) > { > cout << "Socket creation failed!!!"; > } > > SockAddr.sin_port = 50; > SockAddr.sin_family = AF_INET; > SockAddr.sin_addr.S_un.S_un_b.s_b1 = 192; > SockAddr.sin_addr.S_un.S_un_b.s_b2 = 168; > SockAddr.sin_addr.S_un.S_un_b.s_b3 = 1; > SockAddr.sin_addr.S_un.S_un_b.s_b4 = 102; > > if (bind (Socket, (SOCKADDR *)(&SockAddr), sizeof (SockAddr)) == > SOCKET_ERROR) > { > cout << "Attempt to bind failed!!!"; > } > > listen (Socket, 1); > > while (TempSocket == SOCKET_ERROR) > { > TempSocket = accept (Socket, &ConnAddr, sizeof (ConnAddr)); > } > Socket = TempSocket; > > printf ("%s", ConnAddr.sa_data); > while (a <= filename.length()) > { > send_str[0] = filename[a]; > cout << send_str; > send (Socket, send_str, 1, 0); > ++a; > } > > infile.open (filename.c_str()); > while (!infile.eof()) > { > in_char = infile.get(); > send_str[0] = in_char; > cout << send_str; > send (Socket, send_str, 1, 0); > } > infile.close(); > > > while (RetVal == SOCKET_ERROR) > { > RetVal = recv (Socket, recv_str, 6, 0); > } > cout << recv_str; > > system ("pause"); > return 0; > } > The problem text is highlighted in green. I get the error message > "invalid conversion from 'unsigned int' to 'int *' initializing argument > 3 of 'SOCKET accept (SOCKET, sockaddr*, int*)'. But how else am i > supposed to pass the size of the structure to the method? > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Per W. <pw...@ia...> - 2007-12-07 11:56:49
|
The RS232 API in Windows supports event-driven processing. You can get an event when a receive buffer is full, a specific 'match' character is received or there has been a timeout between two characters. A match character is maningful to catch a line-break in ASCII protocols, or the end-of-message byte in a binary protocol. You normally don't let the RS232 thread process characters one at a time, so you normally don't generate an update event every character. When implementing a chat, the RS232 code will normally trig on the pause between individual characters, resulting in a character-at-a-time update of the GUI. If the user pastes a large block of text, the serial driver will instead generate events based on serial buffer size with an optional time-out event after the paste. Is the receive buffer large enough, the paste will only result in a single timeout event, i.e. a single GUI update. A computer-driven communication will on the other hand trig on buffer-full events or the end-of-message event from the filter character, and allowing updates of the GUI a message at a time or a full serial buffer at a time. For this kind of communication, the GUI would normally not display actual data, but instead transfer statistics, i.e. # of packets, # of bytes, # of resends or similar. In the end, there will normally not be a problem with a dying GUI overloaded by more and more cached events, since the amount of events will normally be limited by the RS232 configuration. A correct implementation of the GUI would also make use of PeekMessage() whenever it receives an update event but before it performs the updating. This allows multiple pending update events to only result in a single screen redraw. A message-based solution will consume zero processing power when the serial channel is idle, and will generate redraw load corresponding to buffer size, timeout and end-of-message intervals when data is arriving. /pwm On Thu, 6 Dec 2007, Chris Miller wrote: > On Dec 6, 2007 2:41 AM, Per Westermark <pw...@ia...> wrote: > > One alternative is to let the RS232 thread send messages to the GUI > > thread. Either with the serial data, or just as information that there are > > serial data available. > > > > /pwm > > I would like to note that this does have a significant drawback. > > If you have to update the GUI every time something happens, it has a > tendency to lag in a big way. > > You can alleviate this by only updating every X updates, however, this > adds a problem of constantly checking whether or not the update > threshold has been reached. It's far simpler to use the mutex > approach, even though it is slightly more difficult to implement and > harder to understand (if you're not familiar with it). > > Once I tried having the working thread update the GUI in Java.... > locked up the whole GUI during operation, so if you wanted to kill it > you'd have to kill the running JVM - not fun! > > -- > Registered Linux Addict #431495 > http://profile.xfire.com/mrstalinman > John 3:16! > If Microsoft is the Wal*Mart of the Software World, then Linux is the Home Depot > |
From: hhh h. <the...@ho...> - 2007-12-07 10:55:29
|
Hi all, Well, I must say that this thread really interests me. Could we have a look at your query code for the RS232 device? >From: "Chris Miller" <lor...@gm...> >To: "Per Westermark" <pw...@ia...> >CC: dev...@li... >Subject: Re: [Dev-C++] how to update data constantly? >Date: Thu, 6 Dec 2007 14:49:32 -0800 > >On Dec 6, 2007 2:41 AM, Per Westermark <pw...@ia...> wrote: > > One alternative is to let the RS232 thread send messages to the GUI > > thread. Either with the serial data, or just as information that there >are > > serial data available. > > > > /pwm > >I would like to note that this does have a significant drawback. > >If you have to update the GUI every time something happens, it has a >tendency to lag in a big way. > >You can alleviate this by only updating every X updates, however, this >adds a problem of constantly checking whether or not the update >threshold has been reached. It's far simpler to use the mutex >approach, even though it is slightly more difficult to implement and >harder to understand (if you're not familiar with it). > >Once I tried having the working thread update the GUI in Java.... >locked up the whole GUI during operation, so if you wanted to kill it >you'd have to kill the running JVM - not fun! > >-- >Registered Linux Addict #431495 >http://profile.xfire.com/mrstalinman >John 3:16! >If Microsoft is the Wal*Mart of the Software World, then Linux is the Home >Depot > >------------------------------------------------------------------------- >SF.Net email is sponsored by: >Check out the new SourceForge.net Marketplace. >It's the best place to buy or sell services for >just about anything Open Source. >http://sourceforge.net/services/buy/index.php >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Transfira JÁ a última versão do Windows Live Messenger! http://get.live.com/pt-pt/messenger/overview |
From: Ben M. <ili...@at...> - 2007-12-07 03:51:16
|
adrian wrote: > Доброго времени суток, ili...@at...! > Вами, Ben Melikant <mailto:ili...@at...> было написано: > > >> hello. I am trying to write that winsock app that i was working on >> the other day. I want to find the IP address of the computer that is >> connecting to the server. Here is the code for the server application: >> >> #include <winsock2.h> >> #include <windows.h> >> #include <iostream> >> #include <fstream> >> #include <string> >> >> using namespace std; >> >> int main () >> { >> WSADATA wsadat; >> SOCKET Socket, TempSocket = SOCKET_ERROR; >> SOCKADDR_IN SockAddr; >> SOCKADDR ConnAddr; >> ifstream infile; >> string filename = "C:\\counter.java"; >> char send_str[1], recv_str[6]; >> int a = 0, in_char, RetVal; >> >> if (WSAStartup (MAKEWORD(1,1), &wsadat) != 0) >> { >> cout << "WSAStartup failed!!!"; >> } >> >> Socket = socket(AF_INET, SOCK_STREAM, 0); >> if (Socket == INVALID_SOCKET) >> { >> cout << "Socket creation failed!!!"; >> } >> > >> SockAddr.sin_port = 50; > Do U believe what 50 port is always free? Ports less than 1024 is > standard ports and may be allocated with another program. In any ways > you need another port when your port don't acceptabling. Also U need > write: > SockAddr.sin_port=htons(50);//or another port number >> SockAddr.sin_family = AF_INET; > //------------------------------------------------------- >> SockAddr.sin_addr.S_un.S_un_b.s_b1 = 192; >> SockAddr.sin_addr.S_un.S_un_b.s_b2 = 168; >> SockAddr.sin_addr.S_un.S_un_b.s_b3 = 1; >> SockAddr.sin_addr.S_un.S_un_b.s_b4 = 102; > this paragraph can be replaced with: > SockAddr.sin_addr.s_addr=inet_addr("192.168.1.102"); > you can replace text in "" with any address U need. > >> if (bind (Socket, (SOCKADDR *)(&SockAddr), sizeof (SockAddr)) == >> SOCKET_ERROR) >> { >> cout << "Attempt to bind failed!!!"; >> } >> >> listen (Socket, 1); >> >> while (TempSocket == SOCKET_ERROR) >> { >> TempSocket = accept (Socket, &ConnAddr, sizeof (ConnAddr)); >> } >> Socket = TempSocket; >> >> printf ("%s", ConnAddr.sa_data); >> while (a <= filename.length()) >> { >> send_str[0] = filename[a]; >> cout << send_str; >> send (Socket, send_str, 1, 0); >> ++a; >> } >> >> infile.open (filename.c_str()); >> while (!infile.eof()) >> { >> in_char = infile.get(); >> send_str[0] = in_char; >> cout << send_str; >> send (Socket, send_str, 1, 0); >> } >> infile.close(); >> >> >> while (RetVal == SOCKET_ERROR) >> { >> RetVal = recv (Socket, recv_str, 6, 0); >> } >> cout << recv_str; >> >> system ("pause"); >> return 0; >> } >> The problem text is highlighted in green. I get the error message >> "invalid conversion from 'unsigned int' to 'int *' initializing >> argument 3 of 'SOCKET accept (SOCKET, sockaddr*, int*)'. But how else >> am i supposed to pass the size of the structure to the method? >> > This error mean what U sent constant int in function what demand > pointer on int. > IMHO U need write: > > ... > int iSize=sizeof(SOCKADDR); > ...=accept(Socket, (sockaddr_in*)&ConnAddr, &iSize); > > I don't saw green text 'cos I recieve mail it plain text format. IMHO > many another people also receiving messages in plain text format and > can't see color mark. > > С уважением, Чурин. > P.S. Excuse me for my bad english - it's not my native language. > > > Well, now i have another problem. How can I get the value of > ConnAddr.sa_data to print to the screen? When i try to print it using > printf("%s", ConnAddr.sa_data) it prints only a 2. |
From: Ben M. <ili...@at...> - 2007-12-07 03:05:28
|
hello. I am trying to write that winsock app that i was working on the other day. I want to find the IP address of the computer that is connecting to the server. Here is the code for the server application: #include <winsock2.h> #include <windows.h> #include <iostream> #include <fstream> #include <string> using namespace std; int main () { WSADATA wsadat; SOCKET Socket, TempSocket = SOCKET_ERROR; SOCKADDR_IN SockAddr; SOCKADDR ConnAddr; ifstream infile; string filename = "C:\\counter.java"; char send_str[1], recv_str[6]; int a = 0, in_char, RetVal; if (WSAStartup (MAKEWORD(1,1), &wsadat) != 0) { cout << "WSAStartup failed!!!"; } Socket = socket(AF_INET, SOCK_STREAM, 0); if (Socket == INVALID_SOCKET) { cout << "Socket creation failed!!!"; } SockAddr.sin_port = 50; SockAddr.sin_family = AF_INET; SockAddr.sin_addr.S_un.S_un_b.s_b1 = 192; SockAddr.sin_addr.S_un.S_un_b.s_b2 = 168; SockAddr.sin_addr.S_un.S_un_b.s_b3 = 1; SockAddr.sin_addr.S_un.S_un_b.s_b4 = 102; if (bind (Socket, (SOCKADDR *)(&SockAddr), sizeof (SockAddr)) == SOCKET_ERROR) { cout << "Attempt to bind failed!!!"; } listen (Socket, 1); while (TempSocket == SOCKET_ERROR) { TempSocket = accept (Socket, &ConnAddr, sizeof (ConnAddr)); } Socket = TempSocket; printf ("%s", ConnAddr.sa_data); while (a <= filename.length()) { send_str[0] = filename[a]; cout << send_str; send (Socket, send_str, 1, 0); ++a; } infile.open (filename.c_str()); while (!infile.eof()) { in_char = infile.get(); send_str[0] = in_char; cout << send_str; send (Socket, send_str, 1, 0); } infile.close(); while (RetVal == SOCKET_ERROR) { RetVal = recv (Socket, recv_str, 6, 0); } cout << recv_str; system ("pause"); return 0; } The problem text is highlighted in green. I get the error message "invalid conversion from 'unsigned int' to 'int *' initializing argument 3 of 'SOCKET accept (SOCKET, sockaddr*, int*)'. But how else am i supposed to pass the size of the structure to the method? |
From: angel d. <sci...@ho...> - 2007-12-06 23:04:27
|
Hello, =20 I wrote a struct into a ofstream file. But When i try to read the content of the file, i get binary codes. Is there a = way to read the content of the file as it was written. _________________________________________________________________ Your smile counts. The more smiles you share, the more we donate.=A0 Join i= n. www.windowslive.com/smile?ocid=3DTXT_TAGLM_Wave2_oprsmilewlhmtagline= |
From: Chris M. <lor...@gm...> - 2007-12-06 22:49:36
|
On Dec 6, 2007 2:41 AM, Per Westermark <pw...@ia...> wrote: > One alternative is to let the RS232 thread send messages to the GUI > thread. Either with the serial data, or just as information that there are > serial data available. > > /pwm I would like to note that this does have a significant drawback. If you have to update the GUI every time something happens, it has a tendency to lag in a big way. You can alleviate this by only updating every X updates, however, this adds a problem of constantly checking whether or not the update threshold has been reached. It's far simpler to use the mutex approach, even though it is slightly more difficult to implement and harder to understand (if you're not familiar with it). Once I tried having the working thread update the GUI in Java.... locked up the whole GUI during operation, so if you wanted to kill it you'd have to kill the running JVM - not fun! -- Registered Linux Addict #431495 http://profile.xfire.com/mrstalinman John 3:16! If Microsoft is the Wal*Mart of the Software World, then Linux is the Home Depot |
From: <Mat...@bm...> - 2007-12-06 20:34:29
|
Hello, You certainly can use winsock with dev cpp.=20 In the project options, parameters make sure you link libws2_32.a. Also include the following headers with your source file... #include <winsock2.h> #include <ws2tcpip.h> I can post an example if you would like. Cheers >-----Original Message----- >From: dev...@li... [mailto:dev-cpp-users- >bo...@li...] On Behalf Of Ben Melikant >Sent: 06 December 2007 03:56 >To: dev...@li... >Subject: [Dev-C++] internet programming > >I was wondering if anyone may be able to tell me whether I can use >winsock with dev? im not sure how to link to wsock32.lib > > >----------------------------------------------------------------------- -- >SF.Net email is sponsored by: The Future of Linux Business White Paper >from Novell. From the desktop to the data center, Linux is going >mainstream. Let it simplify your IT future. >http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users This email was sent from an email account of BMW (UK) Manufacturing Limited= . BMW (UK) Manufacturing Limited is a company registered in England and Wal= es with company number 3950868; and has its offices at Ellesfield Avenue, B= racknell, Berkshire, RG12 8TA; registered in England and Wales. The content= s of this e-mail are confidential and may be privileged and subject to inte= rnal monitoring. If you are not the addressee indicated in this message, yo= u may not copy, forward, disclose, deliver or otherwise use it or any part = of it in any form whatsoever. You should then kindly notify the sender by r= eplying to this message and destroy it thereafter. Opinions, conclusions an= d other information in this message that do not relate to the official busi= ness of any BMW Group Company shall be understood as neither given nor endo= rsed by them. |
From: Jessica C. <jes...@gm...> - 2007-12-06 17:49:09
|
Hey, Chris, I think you really don't need to consider if it is dual-core or not. Just think it as one processor when you write code. The requests write or read, either one won't be disregards by memory controller. The OS will arrange this. I mean, low level software controls the sequence, not hardware itself. I used to use 4-core processor (a kind of SOC, system on a chip). Its OS provides me the interface of which I (users) can control the each core of the processor. So I(user) can decide which one I want to process first, either write request or read request. Thanks, Jessica --What if you had a dual-core CPU, and you managed to send a read request exactly when you sent a write request? Something tells me that's not possible because of the mutexes in the lower-level implementation, but it would be interesting to see which request the memory controller disregards. On Dec 5, 2007 5:32 PM, Chris Miller <lor...@gm...> wrote: > On Dec 5, 2007 1:10 PM, Jessica Chen <jes...@gm...> wrote: > > My whole projects have two thread. > > one thread is reading RS-232 communication port. > > another thread is Win32 GUI to display the data got from RS-232 > > communication port. > > > > The design I had is: > > Buttons on Win32 GUI. > > So when the button is clicked, the corresponding data is read from RS232 > > thread, and display in the GUI thread. > > > > BUT I want to have a constantly updated display. That is, there is NO > > button to trigger the data update. > > When the data of RS232 thread is updated, my display of GUI thread need > to > > be updated. > > What should I design? > > > > My consideration for the design is: > > add a constant interval timer to trigger the data update. > > but how to implement it? > > and do you have any other good idea? > > A commonly used technique is to have the GUI thread check the reader > thread every X miliseconds. This requires that you use a mutex to > lock the data while it's being read, otherwise you might incur the > wrath of undefined behavior when reading memory that's currently being > written to. > > What if you had a dual-core CPU, and you managed to send a read > request exactly when you sent a write request? Something tells me > that's not possible because of the mutexes in the lower-level > implementation, but it would be interesting to see which request the > memory controller disregards. > > > I'm not sure how to implement a mutex in a Win32 thread, however, > pthreads is only a wrapper on top of Win32, so it can be done (I > didn't notice any special code in the pthreads sources when I glossed > over them). > > -- > Registered Linux Addict #431495 > http://profile.xfire.com/mrstalinman > John 3:16! > If Microsoft is the Wal*Mart of the Software World, then Linux is the Home > Depot > |
From: Jessica C. <jes...@gm...> - 2007-12-06 17:14:10
|
I don't understand this point. I think a cheaper form of semaphore (whatever for Win32 application or Unix application) is mutex. A critical section is a piece of code which access a shared resource (like data) of two threads. Can you pls do a bit more explanation about your issue? On Dec 6, 2007 5:43 AM, Per Westermark <pw...@ia...> wrote: > A cheaper form of mutex for Win32 applications are the critical > sections. In some situations a semaphore may be suitable. > > /pwm > > On Wed, 5 Dec 2007, Chris Miller wrote: > > > On Dec 5, 2007 1:10 PM, Jessica Chen <jes...@gm...> wrote: > > > My whole projects have two thread. > > > one thread is reading RS-232 communication port. > > > another thread is Win32 GUI to display the data got from RS-232 > > > communication port. > > > > > > The design I had is: > > > Buttons on Win32 GUI. > > > So when the button is clicked, the corresponding data is read from > RS232 > > > thread, and display in the GUI thread. > > > > > > BUT I want to have a constantly updated display. That is, there is NO > > > button to trigger the data update. > > > When the data of RS232 thread is updated, my display of GUI thread > need to > > > be updated. > > > What should I design? > > > > > > My consideration for the design is: > > > add a constant interval timer to trigger the data update. > > > but how to implement it? > > > and do you have any other good idea? > > > > A commonly used technique is to have the GUI thread check the reader > > thread every X miliseconds. This requires that you use a mutex to > > lock the data while it's being read, otherwise you might incur the > > wrath of undefined behavior when reading memory that's currently being > > written to. > > > > What if you had a dual-core CPU, and you managed to send a read > > request exactly when you sent a write request? Something tells me > > that's not possible because of the mutexes in the lower-level > > implementation, but it would be interesting to see which request the > > memory controller disregards. > > > > > > I'm not sure how to implement a mutex in a Win32 thread, however, > > pthreads is only a wrapper on top of Win32, so it can be done (I > > didn't notice any special code in the pthreads sources when I glossed > > over them). > > > > -- > > Registered Linux Addict #431495 > > http://profile.xfire.com/mrstalinman > > John 3:16! > > If Microsoft is the Wal*Mart of the Software World, then Linux is the > Home Depot > > > > > ------------------------------------------------------------------------- > > SF.Net email is sponsored by: The Future of Linux Business White Paper > > from Novell. From the desktop to the data center, Linux is going > > mainstream. Let it simplify your IT future. > > http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > |
From: Jessica C. <jes...@gm...> - 2007-12-06 17:08:27
|
Thanks so much, Rafael. I think I understand your method to solve the problem what I met. And I believe this method can help me solve the problem. But it is a little bit difficult. I mean, for the whole code structure, you need one more thread to trigger my GUI code. Then the whole structure of the project is not that reasonable. :-) Your idea is based on "Singal Triggered". It belongs to the design of CPU-bound system. (As my understanding, CPU-bound system triggers events by signals.) But unfortunately, it seems Win32 API GUI design is I/O bound system. (As my understanding, I/O bound system triggers events by I/O input, like buttons.) Your consideration is still great and classic, specially when using CPU-bound system. Now I am using Chris' way to solve my problem. "A commonly used technique is to have the GUI thread check the reader thread every X miliseconds." BTW, I am new in the area of Win32 API programming. Anything wrong/unclear, pls let me know. On Dec 6, 2007 11:44 AM, Chris Miller <lor...@gm...> wrote: > On Dec 6, 2007 8:41 AM, Jessica Chen <jes...@gm...> wrote: > > Thanks, Chris. > > > > Your way of "A commonly used technique is to have the GUI thread check > the > > reader > > thread every X miliseconds." works fine in my project. > > Hey, worked fine in Java, why can't it work in C++? > > Glad it worked! > > -- > Registered Linux Addict #431495 > http://profile.xfire.com/mrstalinman > John 3:16! > If Microsoft is the Wal*Mart of the Software World, then Linux is the Home > Depot > |
From: Chris M. <lor...@gm...> - 2007-12-06 16:44:46
|
On Dec 6, 2007 8:41 AM, Jessica Chen <jes...@gm...> wrote: > Thanks, Chris. > > Your way of "A commonly used technique is to have the GUI thread check the > reader > thread every X miliseconds." works fine in my project. Hey, worked fine in Java, why can't it work in C++? Glad it worked! -- Registered Linux Addict #431495 http://profile.xfire.com/mrstalinman John 3:16! If Microsoft is the Wal*Mart of the Software World, then Linux is the Home Depot |
From: Jessica C. <jes...@gm...> - 2007-12-06 16:41:55
|
Thanks, Chris. Your way of "A commonly used technique is to have the GUI thread check the reader thread every X miliseconds." works fine in my project. Do mutex in win32 API is as follows: thread 1: // wait_result = WaitForSingleObject(hMutex, 1000); // // if (wait_result == WAIT_OBJECT_0) // { // // data processing: data need to be copied from local to shared area. <----- // ReleaseMutex(hMutex); // } // else // { // // error // } thread 2: // wait_result = WaitForSingleObject(hMutex, 1000); // // if (wait_result == WAIT_OBJECT_0) // { // // data processing: data need to be copied from shared data to local area. <-------- // ReleaseMutex(hMutex); // } // else // { // // error // } On Dec 5, 2007 5:32 PM, Chris Miller <lor...@gm...> wrote: > On Dec 5, 2007 1:10 PM, Jessica Chen <jes...@gm...> wrote: > > My whole projects have two thread. > > one thread is reading RS-232 communication port. > > another thread is Win32 GUI to display the data got from RS-232 > > communication port. > > > > The design I had is: > > Buttons on Win32 GUI. > > So when the button is clicked, the corresponding data is read from RS232 > > thread, and display in the GUI thread. > > > > BUT I want to have a constantly updated display. That is, there is NO > > button to trigger the data update. > > When the data of RS232 thread is updated, my display of GUI thread need > to > > be updated. > > What should I design? > > > > My consideration for the design is: > > add a constant interval timer to trigger the data update. > > but how to implement it? > > and do you have any other good idea? > > A commonly used technique is to have the GUI thread check the reader > thread every X miliseconds. This requires that you use a mutex to > lock the data while it's being read, otherwise you might incur the > wrath of undefined behavior when reading memory that's currently being > written to. > > What if you had a dual-core CPU, and you managed to send a read > request exactly when you sent a write request? Something tells me > that's not possible because of the mutexes in the lower-level > implementation, but it would be interesting to see which request the > memory controller disregards. > > > I'm not sure how to implement a mutex in a Win32 thread, however, > pthreads is only a wrapper on top of Win32, so it can be done (I > didn't notice any special code in the pthreads sources when I glossed > over them). > > -- > Registered Linux Addict #431495 > http://profile.xfire.com/mrstalinman > John 3:16! > If Microsoft is the Wal*Mart of the Software World, then Linux is the Home > Depot > |
From: Lloyd <ll...@cd...> - 2007-12-06 13:11:54
|
Hi, I want to write an extendable application where new classes can be added with out modifying an existing code. Let me brief it with an example. I am writing a network packet dissector. Each packet may consist of so many protocols in a hierarchical manner. We will know the protocol in level 'n' from the 'n-1' th level. Though there are hundreds of protocols we must be able to add new protocols without modifying the existing code. So when we are on protocol at level 'n', it must be able to determine the protocol at level 'n+1' and create the object. how can I do this? my present implementation would be like this func_proto(int ProtocolType) { switch(ProtocolType) { case IP: DissectProto(IP); case ARP: DissectProto(ARP); .... } } DissectProto(int type) { //Extract info from packet... ...... // Determine the type of protcol in the next level .... //call func_proto with identified protocol type func_proto(ProtocolType); } Here I would have to add new cases as we add new protocol dissectors, Instead of that can I use any better way? Thank you very much Lloyd ______________________________________ Scanned and protected by Email scanner |
From: Per W. <pw...@ia...> - 2007-12-06 10:43:12
|
A cheaper form of mutex for Win32 applications are the critical sections. In some situations a semaphore may be suitable. /pwm On Wed, 5 Dec 2007, Chris Miller wrote: > On Dec 5, 2007 1:10 PM, Jessica Chen <jes...@gm...> wrote: > > My whole projects have two thread. > > one thread is reading RS-232 communication port. > > another thread is Win32 GUI to display the data got from RS-232 > > communication port. > > > > The design I had is: > > Buttons on Win32 GUI. > > So when the button is clicked, the corresponding data is read from RS232 > > thread, and display in the GUI thread. > > > > BUT I want to have a constantly updated display. That is, there is NO > > button to trigger the data update. > > When the data of RS232 thread is updated, my display of GUI thread need to > > be updated. > > What should I design? > > > > My consideration for the design is: > > add a constant interval timer to trigger the data update. > > but how to implement it? > > and do you have any other good idea? > > A commonly used technique is to have the GUI thread check the reader > thread every X miliseconds. This requires that you use a mutex to > lock the data while it's being read, otherwise you might incur the > wrath of undefined behavior when reading memory that's currently being > written to. > > What if you had a dual-core CPU, and you managed to send a read > request exactly when you sent a write request? Something tells me > that's not possible because of the mutexes in the lower-level > implementation, but it would be interesting to see which request the > memory controller disregards. > > > I'm not sure how to implement a mutex in a Win32 thread, however, > pthreads is only a wrapper on top of Win32, so it can be done (I > didn't notice any special code in the pthreads sources when I glossed > over them). > > -- > Registered Linux Addict #431495 > http://profile.xfire.com/mrstalinman > John 3:16! > If Microsoft is the Wal*Mart of the Software World, then Linux is the Home Depot > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: The Future of Linux Business White Paper > from Novell. From the desktop to the data center, Linux is going > mainstream. Let it simplify your IT future. > http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Per W. <pw...@ia...> - 2007-12-06 10:41:20
|
One alternative is to let the RS232 thread send messages to the GUI thread. Either with the serial data, or just as information that there are serial data available. /pwm On Wed, 5 Dec 2007, Jessica Chen wrote: > My whole projects have two thread. > one thread is reading RS-232 communication port. > another thread is Win32 GUI to display the data got from RS-232 > communication port. > > The design I had is: > Buttons on Win32 GUI. > So when the button is clicked, the corresponding data is read from RS232 > thread, and display in the GUI thread. > > BUT I want to have a constantly updated display. That is, there is NO > button to trigger the data update. > When the data of RS232 thread is updated, my display of GUI thread need to > be updated. > What should I design? > > My consideration for the design is: > add a constant interval timer to trigger the data update. > but how to implement it? > and do you have any other good idea? > |
From: Ben M. <ili...@at...> - 2007-12-06 03:56:46
|
I was wondering if anyone may be able to tell me whether I can use winsock with dev? im not sure how to link to wsock32.lib |