|
See if this helps
inet_ntoa(client.sin_addr)
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
hmm.. getting 204.204.204.204 from the inet_ntoa.. which probably means.. that part of the accept is not going to help me get the ip... i assume..
ive seen this before....
char hostname[256]; struct hostent *host; in_addr ip; gethostname(hostname, 256); host = gethostbyname(hostname); memcpy(&ip, host->h_addr, sizeof(ip)); printf("First host IP is: %s\n", inet_ntoa(ip));
which seems to get the local ip.. which is not what im trying to do...
|
|
|
|
|
I think you can get the IP in this manner:
sockaddr_in clientAddress;
accept( ..., (SOCKADDR*)&clientAddress, ...);
in_addr inAddr = clientAddress.sin_addr;
Now the four components of IP, from left to right, are in inAddr.S_un.S_un_b.s_b# members:
printf("The IP is: %i.%i.%i.%i",
inAddr.S_un.S_un_b.s_b1,
inAddr.S_un.S_un_b.s_b2,
inAddr.S_un.S_un_b.s_b3,
inAddr.S_un.S_un_b.s_b4);
Hope it helps.
|
|
|
|
|
here i had aproblem in usage of smpp ie the parameters are not matching with the code in SMPPlibTest.so plz kindely help me howto use SMPP in my project to send SMS
#sankar#
|
|
|
|
|
plz give me solution to solve this problem
#sankar#
-- modified at 4:23 Thursday 22nd June, 2006
|
|
|
|
|
Hello everyone...
Below is a complete sample application.
How can i get the same output but the shape must be circle??
which line of coding do i need to change?
Please help me here.
It is urgent.
Thanks alot
Tillandran
-----------------------------------------------------------------------------
#include <windows.h>
#include <gl\gl.h>
#include <gl\glaux.h>
#include<math.h>
//initial square position and its size
GLfloat x=250.0f;
GLfloat y=0.0f;
GLsizei rsize=50;
GLfloat x2=0.0f;
GLfloat y2=0.0f;
GLfloat x3=250.0f;
GLfloat y3=250.0f;
GLfloat x4=0.0f;
GLfloat y4=250.0f;
//step size in x and y directions
//number of pixels to move each time
GLfloat xstep=0.10f;
GLfloat ystep=0.10f;
GLfloat x2step=0.10f;
GLfloat y2step=0.10f;
GLfloat x3step=0.10f;
GLfloat y3step=0.10f;
GLfloat x4step=0.10f;
GLfloat y4step=0.10f;
//keep track of window's changing width and height
GLfloat windowWidth;
GLfloat windowHeight;
//called by AUX library when the windows has changed size
void CALLBACK ChangeSize(GLsizei w, GLsizei h)
{
//prevent a divide by zero. when window is too short
// you cannot make a window zero width
if(h==0)
h=1;
//set the viewport to be the entire window
glViewport(0,0,w,h);
//Reset the coordinate system before modifying
glLoadIdentity();
//keep the square square, this time, save calculated width and height for later use
if(w<=h)
{
windowHeight=250.0f*h/w;
windowWidth=250.0f;
}
else
{
windowWidth=250.0f * w/h;
windowHeight=250.0f;
}
//set the clipping volume
glOrtho(1.0f, windowWidth, 0.01, windowHeight, 1.0f, -1.0f);
}
//called by AUX library to update window
void CALLBACK RenderScene(void)
{
glClearColor(0.0f,0.0f,1.0f,0.0f);
glClear(GL_COLOR_BUFFER_BIT);
//set drawing color to red and draw rectangle at current position
glColor3f(0.0f,1.0f,0.0f);
glRectf(x2,y2,x2+rsize,y2+rsize);
glColor3f(1.0f,0.0f,0.0f);
glRectf(x3,y3,x3+rsize,y3+rsize);
glColor3f(1.0f,0.0f,0.0f);
glRectf(x4,y4,x4+rsize,y4+rsize);
glColor3f(1.0f, 1.0f, 0.0f);
glRectf(x,y,x+rsize,y+rsize);
glFlush();
}
//called by AUX library when idle(window not being resized or moved)
void CALLBACK IdleFunction(void)
{
//reverse direction when you reach let or right edge
if(x>windowWidth-rsize || x<0)
xstep=-xstep;
//reverse direction when you reach top or bottom edge
if(y>windowHeight-rsize || y<0)
ystep=-ystep;
//check bounds. This is in case the window is made smaller and the retangle is outside the new clipping volume
if(x>windowWidth-rsize)
x=windowWidth-rsize-1;
if(y>windowHeight-rsize)
y=windowHeight-rsize-1;
//Actually move the square
x+=xstep;
y+=ystep;
//reverse direction when you reach left or right edge
if(x2>windowWidth-rsize || x2<0)
x2step=-x2step;
//reverse direction when you reach top or bottom edge
if(y2>windowHeight-rsize || y2<0)
y2step=-y2step;
//check bounds. This is in case the window is made smaller and the rectangle is outside the new clipping volume
if(x2>windowWidth-rsize)
x2=windowWidth-rsize-1;
if(y2>windowHeight-rsize)
y2=windowHeight-rsize-1;
if(x3>windowWidth-rsize || x3<0)
x3step=-x3step;
//reverse direction when you reach top or bottom edge
if(y3>windowHeight-rsize || y3<0)
y3step=-y3step;
//check bounds. This is in case the window is made smaller and the rectangle is outside the new clipping volume
if(x3>windowWidth-rsize)
x3=windowWidth-rsize-1;
if(y3>windowHeight-rsize)
y3=windowHeight-rsize-1;
if(x4>windowWidth-rsize || x4<0)
x4step=-x4step;
//reverse direction when you reach top or bottom edge
if(y4>windowHeight-rsize || y4<0)
y4step=-y4step;
//check bounds. This is in case the window is made smaller and the rectangle is outside the new clipping volume
if(x4>windowWidth-rsize)
x4=windowWidth-rsize-1;
if(y4>windowHeight-rsize)
y4=windowHeight-rsize-1;
//Actually move the square
x2+=x2step;
y2+=y2step;
x3+=x3step;
y3+=y3step;
x4+=x4step;
y4+=y4step;
//redraw the scene with new coordinates
RenderScene();
}
//main body of the program
void main(void)
{
//aux window setup and initialization
auxInitDisplayMode(AUX_DOUBLE || AUX_RGBA);
auxInitPosition(100,100,250,250);
auxInitWindow("Assignment 1");
//set function to call when window is resized
auxReshapeFunc(ChangeSize);
auxIdleFunc(IdleFunction);
//start main loop
auxMainLoop(RenderScene);
}
//GLAUX.LIB GLU32.LIB glut32.lib glut.lib OPENGL32.LIB
-- modified at 3:43 Thursday 22nd June, 2006
|
|
|
|
|
|
|
Bad command or ?...
whitesky
|
|
|
|
|
|
in the end i get this error !?
Do you remember "Bad command or file name" in dos,dos(windows 3.1,gwbasic,qbasic,pascal,turbo c)
and clrscr equal cls and....(many years)
whitesky
|
|
|
|
|
Hi..
Actually there is no any error for the program. The program is correct and can be run.How can i get 4 circle shape instead of square?
There are some command missing for the program.
U hv to include this on the top of the program.
After each #include, please key in the folowing code for each #include
#include windows.h
#include gl\gl.h
#include gl\glaux.h
#include math.h
Please delete this and replace with the above code.
#include
#include
#include
#include
Thanks
|
|
|
|
|
Dear all,
Is there an API function that will hide a partition and/or folder in a USB Memory Stick, so the folder will be inaccessible from other computers - that is protecting the contents of the memory stick. Ideally, the program should be stand alone, and no installation would be required on any computers.
Thanks in advance
Derek
|
|
|
|
|
See:-
SetFileAttributes
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
thanks for your reply, SetFileAttributes worked successfully, but i need something that is OS independent, as if the user selects to view all files, the hidden files would also be disclosed. I need to hide a folder on a USB stick which would only be revealed if the correct password is entered using a program independent on the OS settings...im thinking of having some settings at FAT32 level, some way or another
thanks in advance
derek
|
|
|
|
|
derek john grech wrote: but i need something that is OS independent
no way...
hidden file notion is OS/FS dependant, simply because not every OS/FS can choose to implement such a feature.
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
hi thanks for your reply...
yep it seems to be impossible, i didnt find any good programs that feature this...however, once i had a USB memory stick and the program that came along with it allowed to partition the USB memory stick in two, one is unprotected, and the other partition is only revealed if the correct password is entered
i was wondering that this could be accomplished by modifying the FAT32 table indirectly through some API functions...
thanks once again for your assistance
derek
|
|
|
|
|
derek john grech wrote: i was wondering that this could be accomplished by modifying the FAT32 table indirectly through some API functions...
i don't think so. FAT32 FileSystem don't store security infos... you would have to format your partition into NTFS for example, but on a USB stick, i doubt this could be achieved.
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
My guess is that they did some kind of trick with the partition table, making the protected partition invisible until the correct password had been given.
|
|
|
|
|
hi kakan,
yep they did some sort of a trick...that is why i think there a possibility of hiding a partition through FAT32 table...but i do not know how....there are many programs that do hide folders and files but the programs must be installed on the system...where ideally i would require something portable that will work on windows OS platform (windows 2000,XP) using one small exe program ... i know that it could be accomplished in some way or another
i did some research but unfortunately i did not find much
thanks for your help
derek john grech
|
|
|
|
|
The FAT file system (used to) flag an erased file by replacing the first character in the file name with a (hex) E5 character, if I remember it right.
That could be one approach to hiding files (while maintaing the proper FAT table entries for the file in question).
Maybe that's a way to go?
|
|
|
|
|
i will do some research on FAT and experiment a bit...alternatively, do you have some good links that gives detailed (but not too complicated) information of FAT32...
thanks kakan
|
|
|
|
|
Hello.
I have no links for you from the top of my head, sorry.
But there must be heaps of documentation for the FAT file system in the net.
I wrote a program to repair broken FAT-diskettes a few years ago, I have gone through my source code, but there were no links.
So you have to Google for it. Maybe it's better to search with Alta Vista, since this is old information.
Good luck.
Kakan
|
|
|
|
|
Hello EB,
I want to create how to create a socket which will work on a PC having connectivity to internet through proxy.
I use CSocket::Create() but it creates socket on a ip address of server, so my application doesn't able to listen on that socket as it is running on another machine. How can i redirect the msges from server to my PC.
Thanks in advance..
Thanks and Regards,
Amit
|
|
|
|
|
i want to draw a smooth curve given two points.
how do i do that??
|
|
|
|