|
If the server is accessible over the Internet, then it is possible, or if port forwarding is enabled. It needs to be accessed over the Internet via public addresses.
The terms -server- and -client- can mix up, since as soon as you listen() on a socket, that will accept() connections on your client, then your client becomes the server.
The whole scenario would be like the following:
You have a program running at home, on your computer that dials into the ISP. Your PC at home has a public IP address, such as 72.9.248.26, ... Your PC in the university is most probably NAT'ed and firewalled. You will have an internal IP address (RFC1918) such as 10.0.0.1.
From home you cannot reach your univ pc, if you type in "ping 10.0.0.1" it wont get far. From the university however, if you type "ping 72.9.248.26", it will respond (if firewall rules allow). So, to connect to a machine, since you cannot reach your university machine, you have to connect to your home computer, from the university.
Makes a little sense?
Take care,
Michael
--
code.ae
|
|
|
|
|
Hi all,
This is roland working for s/w comp in pune as trainee programmer in SDK (win 32)as i don't have preiveious experience in sdk i am getting some problem.....so can anybody help me....my project is related to desktop & printing ...when user selects a perticular area on desktop or on screen he should get only that area after printing ..
i am getting the selected image on screen but after taking print for it the colors of that image are not appear as they are on screen i am getting very light colors image....i tried lots for this but i didn't get it...i got one API ColorMatchToTarget But where should it place or is it really work for this ???so can anybody help me & guiide me plz???
thks waiting for reply.......
roland
|
|
|
|
|
How can I solve the probelm with the following error message:
"variable" already defined in GO.obj
|
|
|
|
|
This means that you defined "variable" in more than a file, and both defines it as public
If each one should have its copy, try putting static in front of them
If the variable should be shared, declare it as extern in one of the files
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I have added extern to the variables with the error message and
the problem is solved. Thanks!
But i only declare them in one file. Why does the problem occur?
my project name is go and i declare the variables in go.h just below #define... (as global)
|
|
|
|
|
Anonymous wrote:
But i only declare them in one file.
But that .h file is included in multiple places.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Can you show how and where are you doing the declaration?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Its ok now. I know the problem. Thank you very much!
in go.h:
// GO.h : main header file for the GO application
//
#if !defined(AFX_GO_H__76EC2730_7BFA_4A29_9F6A_226E7AEC7B81__INCLUDED_)
#define AFX_GO_H__76EC2730_7BFA_4A29_9F6A_226E7AEC7B81__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
#define MAX_STEP 1000
#define MAX_FILE_NAME 30
#define BOARD_SIZE 19
#define BLACK '@'
#define WHITE 'O'
#define KEP '*'
#define EMPTY '.'
#define EMPTY_STAR '+'
#define CHECKED_LAND 'C'
#define BLACK_LAND 'b'
#define WHITE_LAND 'w'
#define SHARED_LAND ' '
struct step_record
{
char command;
int row;
int col;
};
// global variables:
static char boardc[BOARD_SIZE][BOARD_SIZE];
static char turn;
static int kep_row, kep_col;
static int black_eaten, white_eaten;
static int step_num, last_step_num;
static bool remove_dead_chess;
static bool count;
static float black_land, white_land;
static struct step_record step[MAX_STEP+1];
/////////////////////////////////////////////////////////////////////////////
// CGOApp:
// See GO.cpp for the implementation of this class
//
class CGOApp : public CWinApp
{
public:
...
|
|
|
|
|
Anonymous wrote:
// global variables:
static char boardc[BOARD_SIZE][BOARD_SIZE];
static char turn;
static int kep_row, kep_col;
static int black_eaten, white_eaten;
static int step_num, last_step_num;
static bool remove_dead_chess;
static bool count;
static float black_land, white_land;
static struct step_record step[MAX_STEP+1];
This is wrong!
I believe that you want one variable that is shared among all the components of your application. The current situation is that each object file (component) has its own copy of the variable. So if you execute the following statement in GoApp.cpp:turn = (char)100 the change is only seen in GoApp.cpp, so in GoView.cpp, the variable turn is still undefined!
Try the following instead:
<br />
char boardc[BOARD_SIZE][BOARD_SIZE];<br />
char turn;<br />
extern int kep_row, kep_col;<br />
extern int black_eaten, white_eaten;<br />
extern int step_num, last_step_num;<br />
extern bool remove_dead_chess;<br />
extern bool count;<br />
extern float black_land, white_land;<br />
extern struct step_record step[MAX_STEP+1];<br />
<br />
extern char boardc[BOARD_SIZE][BOARD_SIZE];<br />
extern char turn;<br />
int kep_row, kep_col;<br />
int black_eaten, white_eaten;<br />
int step_num, last_step_num;<br />
bool remove_dead_chess;<br />
bool count;<br />
float black_land, white_land;<br />
struct step_record step[MAX_STEP+1];<br />
This way, the value of the variables is the always the same in every component..
Blog[^]
|
|
|
|
|
I'm trying to edit subitem of a CListCtrl object. Here's what I do:
void CMyDialog::OnBeginLabelEditMyListCtrl(NMHDR* pNMHDR, LRESULT *pResult)
{
// based on current mouse position, find out which item and
// iSubItem are being clicked by using m_myListCtrl.SubItemHitTest(&ht)
// get the rect of the licked sub item by
// m_myListCtrl.getSubItemRect(ht.iItem, ht.iSubItem, LVIR_LABEL, subRect);
// try to put my variable CEdit m_edit at this location
CEdit *plistEdit = m_myListCtrl.GetEditControl();
if ( plistEdit )
{
m_edit.SubClassWindow(plistEdit->m_hWnd); <--- ERROR here
}
// coding to set *pResult
}
when running, the error message is:
Error: Trying to use SubclassWindow with incorrect CWnd
derived class.
hWnd = $608D8 (nIDC=$0000) is not a CEdit.
how come? both plistEdit and m_edit are of CEdit, why this error?
Thanks for any help!
|
|
|
|
|
ok, got it.
I declared m_edit in my header file, and called
m_edit.Create() in the initialization routine.
I shouldn't. that's how I got the assertion failure.
|
|
|
|
|
What is the value of m_edit::m_hWnd before the call to m_edit.SubclassWindow()? m_edit is not allowed to have an window already attached to it before calling SubclassWindow.
Look up CWnd::SubclassWindow in MSDN for more information.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
yes, you are correct.
As my previous post said, I shouldn't call m_edit.Create() in the initialization routine, that cause the assertion failure.
Thank you!
|
|
|
|
|
Hi!
I want to get the main icon of an EXE and then change the main icon of another EXE with the one I got!
How can I implement it?
Thanks!
|
|
|
|
|
Do you mean by actually modifying the .exe file? If so, check out BeginUpdateResource() and UpdateResource(..., RT_ICON, ...) .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I'm trying to port the FreeLing (Natural Language Processor) from linux to windows platform. The FreeLing used the PCRE library for reg-ex.
The FreeLing is built on C++ (normal STL) langauage. And I know that it's required a C++ Wrapper for PCRE. BTW, FreeLing have included C++ Wrapper in their project. I'm trying to use its built-in wrapper because it is modify to suitable for their code. If I change to another wrapper for PCRE, I think I could have a lot of work to modify the wrapper.
Let's see the error here. The Runtime error occur when the "void clone();" in "regexp.h" in FreeLing is running.
Here's the part of "regexp.h" in FreeLing.
The error is on "pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size);" Line.
<br />
private: <br />
<br />
void clone(const RegEx &y) {<br />
size_t size;<br />
if (!y.re) return;<br />
<br />
pcre_fullinfo(y.re, 0, PCRE_INFO_SIZE, &size);<br />
re=(pcre*) new char[size];<br />
if (!re) {<br />
throw "not enough memory";<br />
} else {<br />
std::cout << std::endl << "**** Making new re pointer Allocation successful.. *****" << std::endl;<br />
}<br />
memcpy(re, y.re, size);<br />
<br />
pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size);<br />
pe = (pcre_extra *) new char[size];<br />
<br />
if (!pe) throw "not enough memory";<br />
memcpy(pe, y.pe, size);<br />
<br />
substrcount = y.substrcount;<br />
ovector = new int[3*substrcount];<br />
matchlist = NULL;<br />
}<br />
And the error in pcre_fullinfo(); in PCRE.C is below.
On the line "*((size_t *)where) = (study == NULL)? 0 : study->size;" below "CASE:PCRE_INFO_STUDYSIZE";
<br />
int pcre_fullinfo(const pcre *external_re, const pcre_extra *extra_data, int what, void *where) {<br />
const real_pcre *re = (const real_pcre *)external_re;<br />
const pcre_study_data *study = NULL;<br />
<br />
if (re == NULL || where == NULL) return PCRE_ERROR_NULL;<br />
if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC;<br />
if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0)<br />
study = extra_data->study_data;<br />
<br />
switch (what) {<br />
case PCRE_INFO_OPTIONS:<br />
*((unsigned long int *)where) = re->options & PUBLIC_OPTIONS; break;<br />
<br />
case PCRE_INFO_SIZE:<br />
*((size_t *)where) = re->size; break;<br />
<br />
case PCRE_INFO_STUDYSIZE:<br />
*((size_t *)where) = (study == NULL)? 0 : study->size;<br />
break;<br />
<br />
I'm using VS.NET 2003 and the error-popup say "
Unhandled exception at 0x0053d42d in TestFreeLing.exe: 0xC0000005: Access violation reading location 0xabababab.
I've try to navigate and understand the code for a week. But I don't know how to figure it.
Anybody please help me solve this problem.
Thank you very much.
|
|
|
|
|
More information on the Call Stack under debug
It seem that error is from the "study" variable, which is of "pcre_study_data" type.
<br />
- re 0x00324278 {magic_number=0x50435245 size=0x0000005e tables=0x00737140 "" ...} const real_pcre *<br />
magic_number 0x50435245 unsigned long<br />
size 0x0000005e unsigned int<br />
+ tables 0x00737140 "" const unsigned char *<br />
options 0x00000010 unsigned long<br />
top_bracket 0x0001 unsigned short<br />
top_backref 0x0000 unsigned short<br />
first_byte 0xcdcd unsigned short<br />
req_byte 0xcdcd unsigned short<br />
name_entry_size 0x0003 unsigned short<br />
name_count 0x0000 unsigned short<br />
- study 0xabababab {size=??? options=??? start_bits=0xabababb0 <Bad Ptr> } const pcre_study_data *<br />
size CXX0030: Error: expression cannot be evaluated unsigned int<br />
options CXX0030: Error: expression cannot be evaluated unsigned char<br />
+ start_bits 0xabababb0 <Bad Ptr> unsigned char [32]<br />
|
|
|
|
|
The address 0xabababab indicates a memory following a block allocated by LocalAlloc().
Means that you are stepping (wayyy) outside of your memory block
Try setting a conditional break point on when the variable study change
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I'm trying to watch the variable and set the breakpoint, but I have no idea where to figure out!!. The only thing I would suggest is the variable "study". Any clue/hint?
|
|
|
|
|
In my MDI App that has 4 views ,I want to load a different toolbar for each view
In my Initinstance function I have all the templates sharing the same ChildFrame ?
Engineering is the effort !
|
|
|
|
|
Create all your toolbars when you create the main frame, then use CFrameWnd::ShowControlBar to hide the toolbars you don't want visible and show the ones you do.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Hello,
Hello, MSDN says
this[^] about _CrtIsValidHeapPointer
I use that function to verify that an address is not valid after a function call. The only problem is that this function jumps into the debugger when it finds out that the address is not valid. So this function returns TRUE or it jumps into the debugger and never returns FALSE, which is exactly what I need..
Is there some alternative of this function that does return FALSE instead jumping into the debuffer?
Blog[^]
|
|
|
|
|
You can find the code in dbgheap.c under \crt\src
see what can be done
It mainly uses IsBadReadPtr, IsBadWritePtr and HeapValidate or __sbh_verify_block depending on the OS and if the CRT is statically or dynamically linked
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks, That worked!
Blog[^]
|
|
|
|
|
I created a static splitter window with two horizontal panes. The first pane is derived from CView and the second from CScrollView. I defined the menu function in the second pane's view class. but the control doesnt reach thr. What could be the problem . Can any1 pls help me?
|
|
|
|