|
|
Have you heard about LetMeGoogleThatForYou[^]? You should start linking that from now on. Seems to me searching on Google is a skill we should put on our Resume!
|
|
|
|
|
Sounds great
|
|
|
|
|
Nice try, but that's the first thing I did. Like going down the rabbit's hole, one thing leads to another, but all the while you find nothing with a solid answer. I stated that I was new to SQL and Perl, not the use of a computer and the internet, but thanks for the help, oh that's right, you didn't really answer my question, my bad...
|
|
|
|
|
sk8te320 wrote: Nice try, but that's the first thing I did.
I truly believe you did that. In fact, I'm not even a PHP expert. I was just visiting this PHP forum to see what people were discussing. And I saw that someone kept on providing Google links, so I thought I'd suggest "Let me google that for you" web-site. And I'm sure there's plenty to learn about Google Search... otherwise there won't be books sold about "Google Search Hacks" and "How to do effective Google Search".
Anyways.. hope you have a good one. Peace.
|
|
|
|
|
sk8te320 wrote: but thanks for the help, oh that's right, you didn't really answer my question, my bad...
D'Oh! I just realized you are talking about my response to your question in Perl forum (You posted in PHP forum, and I'm like.. what? When did I say go look in Google?!)
Anywho, my further response is in Perl forum
|
|
|
|
|
The jQuery toolkit has multiple plugins that could handle this
|
|
|
|
|
Hi,
While trying to send routing header by using following raw socket program, i am getting invalid argument error. Can anyone tell me what wrong with this.
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/ip6.h>
#include <errno.h>
#include <string.h>
void main()
{
int sock_fd;
int on = 1;
int offset = 4;
int ret = 0;
struct sockaddr_in6 *daddr;
struct in6_pktinfo pinfo;
struct msghdr msg;
struct cmsghdr *cmsg;
struct iovec *iovector;
socklen_t rthlen = 0;
int cmsglen;
bzero (&msg, sizeof(msg));
sock_fd = socket(AF_INET6, SOCK_RAW, IPPROTO_IPV6);
if(sock_fd < 0)
{
printf("\nClient: Socket Creation Failed: Error %d\n", errno);
return;
}
iovector = (struct iovec*)calloc(1, sizeof(struct iovec));
/* Since for Mobility Header the checksum is located in offset 4, we need to
* set the offset to 4
*/
if (setsockopt(sock_fd, IPPROTO_IPV6, IPV6_RECVRTHDR, &on, sizeof(on)) < 0)
{
printf("\nClient: RTHDR option set failed\n");
return;
}
/* Our Destination Address is fe80::21d:9ff:fe17:5d0e eth0 interface
* i.e. fe80 :021d:09ff:fe17:5d0e
*/
daddr = (struct sockaddr_in6*)calloc(1, sizeof(struct sockaddr_in6));
daddr->sin6_family = AF_INET6;
daddr->sin6_addr.s6_addr16[0] = 0xfe80;
daddr->sin6_addr.s6_addr16[1] = 0x0;
daddr->sin6_addr.s6_addr16[2] = 0x0;
daddr->sin6_addr.s6_addr16[3] = 0x0;
daddr->sin6_addr.s6_addr16[4] = 0x021d;
daddr->sin6_addr.s6_addr16[5] = 0x09ff;
daddr->sin6_addr.s6_addr16[6] = 0xfe17;
daddr->sin6_addr.s6_addr16[7] = 0x5d0e;
daddr->sin6_port = htons(IPPROTO_IPV6);
/* Our Source Address is fe80::21d:9ff:fe17:58c7 eth0 interface
* i.e. fe80 :021d:09ff:fe17:58c7
*/
memset(&pinfo, 0, sizeof(struct in6_pktinfo));
pinfo.ipi6_addr.s6_addr16[0] = 0xfe80;
pinfo.ipi6_addr.s6_addr16[1] = 0x0;
pinfo.ipi6_addr.s6_addr16[2] = 0x0;
pinfo.ipi6_addr.s6_addr16[3] = 0x0;
pinfo.ipi6_addr.s6_addr16[4] = 0x021d;
pinfo.ipi6_addr.s6_addr16[5] = 0x09ff;
pinfo.ipi6_addr.s6_addr16[6] = 0xfe17;
pinfo.ipi6_addr.s6_addr16[7] = 0x58c7;
pinfo.ipi6_ifindex = 2; /* Interface Id */
//Fill ancilliary data and call sendmsg
void *extptr;
socklen_t extlen;
struct cmsghdr *cmsgptr;
extlen = inet6_rth_space(IPV6_RTHDR_TYPE_0, 1);
cmsglen = CMSG_SPACE(extlen);
cmsgptr = malloc(cmsglen);
cmsgptr->cmsg_len = CMSG_LEN(extlen);
cmsgptr->cmsg_level = IPPROTO_IPV6;
cmsgptr->cmsg_type = IPV6_RTHDR;
extptr = CMSG_DATA(cmsgptr);
extptr = inet6_rth_init(extptr, extlen, IPV6_RTHDR_TYPE_0, 1);
int check = inet6_rth_add(extptr, &daddr->sin6_addr);
if (check < 0)
{
printf("FAILURE \n");
}
msg.msg_control = cmsgptr;
msg.msg_controllen = cmsglen;
iovector->iov_base = malloc(10);
iovector->iov_len = 10;
strcpy(iovector->iov_base, "MAG-TO-LMA");
msg.msg_iov = iovector;
msg.msg_iovlen = 1;
msg.msg_name = (void *)daddr;
msg.msg_flags = 0;
msg.msg_namelen = sizeof(struct sockaddr_in6);
ret = sendmsg(sock_fd, &msg, 0);
if (ret < 0)
{
printf("\nClient:Send Message Failed: Error %d Ret %d\n", errno, ret);
free(iovector->iov_base);
free(iovector);
return;
}
}
Regards,
Shekharban
banshekhar
|
|
|
|
|
Hi,
Meanwhile i was trying to send icmp packets; got to know that byte ordering of address is wrong. I tried the above program by changing the address byte order, but with no luck. Could any one please let me know how routing header can be sent as a ancilliary data in v6 and what might be wrong with this code.
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/ip6.h>
#include <errno.h>
#include <string.h>
void main()
{
int sock_fd;
int on = 1;
int offset = 4;
int ret = 0;
struct sockaddr_in6 *daddr;
struct in6_pktinfo pinfo;
struct msghdr msg;
struct cmsghdr *cmsg;
struct iovec *iovector;
socklen_t rthlen = 0;
int cmsglen;
sock_fd = socket(AF_INET6, SOCK_RAW, IPPROTO_IPV6);
if(sock_fd < 0)
{
printf("\nClient: Socket Creation Failed: Error %d\n", errno);
return;
}
iovector = (struct iovec*)calloc(1, sizeof(struct iovec));
/* Since for Mobility Header the checksum is located in offset 4, we need to
* set the offset to 4
*/
if (setsockopt(sock_fd, IPPROTO_IPV6, IPV6_RECVRTHDR, &on, sizeof(on)) < 0)
{
printf("\nClient: RTHDR option set failed\n");
return;
}
/* Our Destination Address is fe80::21d:9ff:fe17:5d0e eth0 interface
* i.e. fe80 :021d:09ff:fe17:5d0e
*/
daddr = (struct sockaddr_in6*)calloc(1, sizeof(struct sockaddr_in6));
daddr->sin6_family = AF_INET6;
daddr->sin6_addr.s6_addr16[0] = 0x80fe;
daddr->sin6_addr.s6_addr16[1] = 0x0;
daddr->sin6_addr.s6_addr16[2] = 0x0;
daddr->sin6_addr.s6_addr16[3] = 0x0;
daddr->sin6_addr.s6_addr16[4] = 0x1d02;
daddr->sin6_addr.s6_addr16[5] = 0xff09;
daddr->sin6_addr.s6_addr16[6] = 0x17fe;
daddr->sin6_addr.s6_addr16[7] = 0x0e5d;
daddr->sin6_port = htons(IPPROTO_IPV6);
/* Our Source Address is fe80::21d:9ff:fe17:58c7 eth0 interface
* i.e. fe80 :021d:09ff:fe17:58c7
*/
memset(&pinfo, 0, sizeof(struct in6_pktinfo));
pinfo.ipi6_addr.s6_addr16[0] = 0x80fe;
pinfo.ipi6_addr.s6_addr16[1] = 0x0;
pinfo.ipi6_addr.s6_addr16[2] = 0x0;
pinfo.ipi6_addr.s6_addr16[3] = 0x0;
pinfo.ipi6_addr.s6_addr16[4] = 0x1d02;
pinfo.ipi6_addr.s6_addr16[5] = 0xff09;
pinfo.ipi6_addr.s6_addr16[6] = 0x17fe;
pinfo.ipi6_addr.s6_addr16[7] = 0xc758;
pinfo.ipi6_ifindex = 2; /* Interface Id */
/* Fill the Routing Header in ancillary data */
rthlen = inet6_rth_space(IPV6_RTHDR_TYPE_0, 1);
cmsglen = CMSG_SPACE(rthlen);
printf("\nClient: rthlen is %d\n", rthlen);
cmsg = malloc(cmsglen);
if (cmsg == NULL)
{
printf("\nClient:Ancillary Data memory allocation failed\n");
return;
}
memset(cmsg, 0, cmsglen);
memset(&msg, 0, sizeof(msg));
iovector->iov_base = malloc(10);
iovector->iov_len = 10;
strcpy(iovector->iov_base, "TEST-4-RH");
msg.msg_control = (void *)cmsg;
msg.msg_controllen = cmsglen;
msg.msg_iov = iovector;
msg.msg_iovlen = 1;
msg.msg_name = (void *)daddr;
msg.msg_namelen = sizeof(struct sockaddr_in6);
void *rthp;
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_len = CMSG_LEN(rthlen);
cmsg->cmsg_level = IPPROTO_IPV6;
cmsg->cmsg_type = IPV6_RTHDR;
rthp = CMSG_DATA(cmsg);
rthp = inet6_rth_init(rthp, rthlen, IPV6_RTHDR_TYPE_0, 1);
if(rthp == NULL)
{
printf("\nClient: Routing Header Init failed\n");
return;
}
inet6_rth_add(rthp, &daddr->sin6_addr);
rthp = NULL;
ret = sendmsg(sock_fd, &msg, 0);
if (ret < 0)
{
printf("\nClient:Send Message Failed: Error %d Ret %d\n", errno, ret);
free(iovector->iov_base);
free(iovector);
return;
}
}
Regards,
Shekharban
banshekhar
|
|
|
|
|
Hi all,
I m working with C under linux and i have a little prob :
while(1)
{
if(scanf("%s", msg)>0)
printf("Yr message is %s\n", msg);
else
}
but when i run the prog it still frozen waiting for the message but i wanna it do the other Job bloc. So is there any function that helps me detecting if there is a key pressed or no ???
Thx.
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
|
How can i download DSL(Damn Small Linux) from the web 'coz i am new to
Linux ?,Plz help
|
|
|
|
|
Go to http://damnsmalllinux.org/download.html[^], select any of the mirrors, then go to the current folder and download current.iso. Burn the image onto a CD, then reboot your system and the DSL live CD should load.
|
|
|
|
|
I have written this code
The call to CreateSharedMem creates and returns the id of shared memory segment but when i call GetSharedMem it returns 0?
Any idea what i am doing wrong ?
Thank You
int CreateSharedMem(char* key_file, char id, int seg_size)
{
int shm_id;
key_t keyval;
if ((keyval = ftok(key_file,id))==-1)
{
perror("ftok");
return -1;
}
// Can use IPC_EXCL which will fail and returns -1 if a segment with the same key exists
if((shm_id = shmget( keyval, seg_size, IPC_CREAT | 0666 | IPC_EXCL )) == -1)
{
perror("shmget");
return(-1);
}
return(shm_id);
}
int GetSharedMem(char* key_file,char id, int seg_size)
{
int shm_id;
key_t key_val;
if ((key_val = ftok(key_file,id))==-1)
{
perror("ftok");
return -1;
}
printf("Key is %d",key_val);
// Can use IPC_EXCL which will fail and returns -1 if a segment with the same key exists
if((shm_id = shmget( key_val , seg_size, IPC_CREAT | 0666 ) == -1))
{
perror("shmget");
return(-1);
}
return(shm_id);
}
main()
{
.
.
/* Create a shared memory */
int my_shm_id = CreateSharedMem("MySharedMem.c",'A',1000);
printf("%d : Shared mem is created\n",my_shm_id);
/* Get the same shared memory */
int my_shm_id = GetSharedMem("MySharedMem.c",'A',1000);
printf("%d is Shared mem that is created\n",my_shm_id);
.
.
}
|
|
|
|
|
Why are you using IPC_CREAT again in GetSharedMem function when you are only trying to get a shared memory?
shouldn't it be something like....
<br />
if((shm_id = shmget( key_val , seg_size, 0666 ) == -1))<br />
-------------------------------------------
It's code that drives you - Shyam
|
|
|
|
|
Let me ask you a straight question to all the Linux.com users. Is linux good enuff?
First i hear that it is free software. We kno that enything free sucks. My office has free coffee which sucks. So Linux does suck. The software / installation / maintainance all sucks.
But windows xp / vista is very stable and secure. They have frequent releases of service packs and vital security updates. All because u pay for it. So i advice all Linux users to stop believing in free and buy Windows / MAC OS X. Let me know ur views on it
|
|
|
|
|
I think it's not about free or not ,it's about the open source ,a open soft spirit!
however , it does depend on your own choice .no one can deny your choice except yourself...
|
|
|
|
|
I've taken a course in the past that covered unix/linux and I have one coming up my final semester. The course I took covered the command line using mainly the bash shell and a few programs like vim and emacs. Anyways I wanted to practice a little at home since alot of programming jobs want unix or linux experience.
I was wondering what is the unix/linux defacto programming environment or do people actually use vim and emacs for that? Also do people still use the command line alot and if so why? I really don't see the advantage of using the command line as compared to using a GUI. Also what distro would you recommend I try?
thanks for you help.
Mike
|
|
|
|
|
Mike command line and GUI are two different worlds. Most jobs that require UNIX / LINUX experience involve you writing shell scripts, scripts that automate processes etc. They don't really require you to develop a GUI.
The defacto programming enviornment for GUI based apps differ because of variety of choices Linux offers . KDevelop, Eclipse, Glade Designer, MonoDevelop are some of the great GUI development tools available. Some distributions have this in-built into them.
MikeMarq wrote: Also what distro would you recommend I try?
Each distro has its own plus and minus. However OpenSUSE 11 was my fav because i came inbuilt with so many dev tools that i rarely needed to connect to internet to download them.
I found the articles written by pseudonym67 at codeproject are a great place to start if you are looking for learning gui development in Linux, though i never spent time in reading them . Hope I do that this diwali.
http://lamp.codeproject.com/script/Articles/MemberArticles.aspx?amid=441940[^]
I have written a simple article on MonoDevelop to consume web services.
http://lamp.codeproject.com/KB/webservices/MonoStockInformation.aspx[^]
As you can see, development in Linux seriously lacked proper articles and was the birth-right of a few people. I personally remember during my college days browsing through page 10 of google search results to learn APIs in Linux. But I feel with the LAMP section of CodeProject this would change and there would be wonderful articles that can teach development in Linux
-------------------------------------------
It's code that drives you - Shyam
modified on Monday, October 27, 2008 2:35 AM
|
|
|
|
|
Thank you for your excellent reply.
|
|
|
|
|
Hi All,
I m fighting against a problem that drove me crazy for long hours, I wanna create a simple prog like Client/Server under linux using C code. I wrote a Server.c and Client.c Files but when i type
$gcc -c Server.c Client.c
$gcc -o Blood *.o
it told me that there is a double declarion of the function main
So could some one tell me how could i test my prog on the same mchine ??? (local) Thank you !!!!
i Need Help so plz !!!
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Blood_HaZaRd wrote: $gcc -c Server.c Client.c
$gcc -o Blood *.o
it told me that there is a double declarion of the function main
Did you try this?
$gcc -c Server.c Client.c
$gcc -o blood_server Server.o
$gcc -o blood_client Client.o
|
|
|
|
|
Ok i asked my professor and here what he told me to do:
after compiling the 2 files:
$gcc - client client.c
$gcc - server server.c
i ha to add a & when calling ther server:
$./server &
then i run the clien
$./client
that's all. i didn't try it yet but i hope that it'll works.
Thank you All for your Help. I appreciate it Well.
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
you will need to compile each file separately. each file creates a different exe, one will create a client exe and the other a server exe.
each file has a main method, when you compile files together it to create a single exe, so what you are doing is incorrect. in short you can't have multiple definitions of a function, in your case that would be 'main'
try:
gcc -o server server.c
gcc -o client client.c
hope this helps
---
Yours Truly, The One and Only!
web: devmentor.org
Design, Code, Test, Deploy
|
|
|
|
|
Dear friends,
I'll appreciate if anyone could help me this problem.
I'm now trying to program with multi-core. For instant, with C/C++, how can I assign a task for the first core and another task for the second core? Is there any instructions support this? Or could you show me where can I find any documents relate to this field.
Thank you very much.
|
|
|
|
|