|
<pre>
Could some kind person help me to analyze this code ?
It is a modification of
http:
I have few basic concerns
1. I am not sure how "client" server gels included in the FULL implementation.
The resource , and many "free source code " copies of it do not include the actual
FULL implementations.
2. I am not sure How EACH USAGE OF "so9cket" interacts.
3, My code sort of works until
When the above code is uncommented the code execution (in debug mode ) STOPS at that line.
I have no reasonable description of the ""accept" function and NOT KNOW how to debug / step thru it – it is "bluez ?" library code.
'I am not sure if "server_socket" belongs to this function...
Part of code :
//HERE
// temporary initialize client to fail code
client = -1;
// select SPC_CA
//rem_addr = "01:23:45:67:89:AB"; // ,SPP_C_addr[19];
// accept one connection
// verify passed paramaters ??
text = "verify server_socket ";
text += QString ::number(server_socket);
text += Q_FUNC_INFO;
text += " @ line ";
text += QString::number(__LINE__);
qDebug() << text;
#ifdef BYPASS
text = " (struct sockaddr *)&rem_addr ";
//text += QString ::number(server_socket);
//text += rem_addr.rc_bdaddr.toString();
text += Q_FUNC_INFO;
text += " @ line ";
text += QString::number(__LINE__);
qDebug() << text;
#endif
//client = accept(server_socket, (struct sockaddr *)&rem_addr, &opt);
text = "verify server_socket ";
text += QString ::number(server_socket);
text += Q_FUNC_INFO;
text += " @ line ";
text += QString::number(__LINE__);
qDebug() << text;
if(client < 0 )
{
//#ifdef C_CODE_TRACE
text = " FAILED accept one connection";
text += Q_FUNC_INFO;
text += " @ line ";
text += QString::number(__LINE__);
text += " client ";
text += QString::number(client );
qDebug() << text;
//#endif
}
else
{
#ifdef C_CODE_TRACE
text = "SUCCESS accept one connection";
text += Q_FUNC_INFO;
text += " @ line ";
text += QString::number(__LINE__);
text += " client ";
text += QString::number(client );
qDebug() << text;
#endif
}
ba2str( &rem_addr.rc_bdaddr, buf );
fprintf(stderr, "Verify accepted rem address connection from %s\n", buf);
memset(buf, 0, sizeof(buf));
// read data from the client
bytes_read = read(client, buf, sizeof(buf));
if( bytes_read > 0 ) {
printf("received [%s]\n", buf);
}
else
{
#ifdef C_CODE_TRACE
text = "NO DATA received - accept one connection";
text += Q_FUNC_INFO;
text += " @ line ";
text += QString::number(__LINE__);
qDebug() << text;
#endif
}
// close connection
// close(client);
return 0;
Here is my partial debug output
"hci_read_remote_name SPP-CA"
"hci_read_remote_name address 98:D3:31:F8:39:33"
"Success contains / found SPP-CA 98:D3:31:F8:39:33"
"Success contains / found SPP-CA 98:D3:31:F8:39:33"
"temporary return "
"int MainWindow_C_CODE_FORM::C_CODE_server() @ line 68"
"OK allocated server socket 27int MainWindow_C_CODE_FORM::C_CODE_server() @ line 90"
"int MainWindow_C_CODE_FORM::C_CODE_server() @ line 97"
"SUCCESS bound to server int MainWindow_C_CODE_FORM::C_CODE_server() @ line 137"
"SUCCESS listen_mode int MainWindow_C_CODE_FORM::C_CODE_server() @ line 161"
"verify server_socket 27int MainWindow_C_CODE_FORM::C_CODE_server() @ line 176"
"verify server_socket 27int MainWindow_C_CODE_FORM::C_CODE_server() @ line 197"
" FAILED accept one connectionint MainWindow_C_CODE_FORM::C_CODE_server() @ line 208 client -1"
Verify accepted rem address connection from 98:D3:31:F8:39:33
"NO DATA received - accept one connectionint MainWindow_C_CODE_FORM::C_CODE_server() @ line 255"
"SUCCESS server activated "
Thanks IBM Documentation[^]
modified 1hr 10mins ago.
|
|
|
|
|
On my home Linux box I want to shrink my root 1.8 TB partition (ext4 ). Even unmounted gparted says "1.8 TB minimum size". And the GUI, accordingly, refuses to shrink it.
Googling til the end of elephanting times led me to resize2f2 how dangerous is that, in your experience?
And just trying to wrap my head around it is there "one filesystem size and one partition size?"
I actually want to reinstall the OS, and have poor experiences of upgrading. I have 0.6 TB of data, that I want to copy to a non-boot partition. and do not fancy the idea of buying storage to be used for an hour or two only. So yes I admit I am cheap and lazy, and I will never ever install Linux with such monolithic partitioning.
Thanks : )
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
When you try to resize the filesystem, are you entering numbers in the edit boxes, or using the slider? gparted won't resize the filesystem if the "Free Space Following" box is 0. Using the slider, the Free space following will automatically be filled in as you move the right-hand endpoint.
A quick google search doesn't suggest that there are any issues with resize2fs, and in any case, if you watch the gparted screen, it uses resize2fs to do its work behind the scenes, anyway.
But, as always, when modifying a filesystem, a backup of important data is wise. At the very least, go out and get yourself a USB drive of a suitable size to store your data, and back it up before proceeding. Then you're covered if the worst happens. Or if you just want to start again.
Edit: I'd add that if your drive is more than 3-5 years old you should consider replacing it anyway.
Keep Calm and Carry On
|
|
|
|
|
Thanks, I have tried every knob in GUI, including the ones you mention. Typing any high (GB) value into Free Space Following ? It just snaps back to some low (MB) value. Seems that "minimum size" really is a minimum.
I will borrow a TBdisk somewhere and try the somewhat promising resize2fs .
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
|
I guess you could take the view that if it isn't important just overwrite everything.
But if is is important you should have a back up anyways so another drive, just for that reason, makes sense. And then less risky if there is a problem (and you end up needing a complete re-install anyways.)
megaadam wrote: I have 0.6 TB of data,
And I just checked Amazon and first 1 TB usb drive is only $40 but 4th one down is only $20.
|
|
|
|
|
Preface, I am not an expert on ext4 at all. But in general, shrinking a file system is a bit riskier than expanding one, but in practice not much more risky than defragmenting. Still, as mentioned, if your data is important, it should be backed up. If it's not, then the next time you install Linux consider having a separate partition for your user files that will remain if even if you wipe the OS one for a reinstall.
Jeremy Falcon
|
|
|
|
|
sudo setcap CAP_NET_ADMIN=eip /path/to/your/executable
The above adds
CAP_NET_ADMIN=eip ability to my executable.
Works as expected.
It is a pain to do this each time I rebuild / develop my executable....
I need permanent solution and I do not care if I need to be a "root" user.
( I think somebody suggested to do this per "boot", but I cannot find it...)
I did try "sudo su" after boot but that did not work.
Cheers
|
|
|
|
|
Member 14968771 wrote: Works as expected.
It is a pain to do this each time I rebuild / develop my executable....
Does Linux not allow you to specify which executables to run on startup of the OS?
Have your automated builds add a copy there and done?
Perhaps I misunderstand your question. Explain more please.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Member 14968771 wrote: It is a pain to do this each time I rebuild / develop my executable....
Technically because that is not part of the build.
But how do you build? Every build system I have seen allows post compilation steps.
If you are just manually building source code then maybe time to look at existing solutions that already provide framework.
Or just create a script file that does the build and then runs the command.
|
|
|
|
|
I am having (the usual ) problems with my Linux OS .
I do not need to backup my data, but I like to have a backup of my OS.
I have plenty of vacant space on my hardware, but not sure how to accomplish this task.
I have used "dd" and it confuses "grub"....even after "update-grub" .
For curious - at present there is a bug ( D_BUS message) and it killed the OS - cannot recover it.
And there is "application not responding ..." issue with certain version...
( Yes I have disabled "automatic update...")
I am not sure RAID5 would work - it would probably pass the problem to the array...
I am open to suggestions.
|
|
|
|
|
|
Going back/ reinstall the original ISO package is not practical when other packages are installed.
|
|
|
|
|
Then you need a backup system that can clone the entire drive.
|
|
|
|
|
Are you saying I cannot backup the OS partition only ?
|
|
|
|
|
No, but to recover that partition if it gets destroyed would need a backup/restore application that is self bootable. Hence the Google search I posted; you will need to check the various products to see if this feature is available.
|
|
|
|
|
Member 14968771 wrote: I do not need to backup my data, but I like to have a backup of my OS.
First question you have to ask yourself is why?
If you're keen to be able to get your system going again after a crash, it can be done. But literally every last thing you do not in userland will need a new backup if you so much as sneeze. If it's a new system, the backup is useless (for the most part). If it's the same system, this is exactly what disk mirroring with RAID was created for. No reason to reinvent the wheel.
That being said, tar was made for this sorta thing. Just don't go backing up /dev and /proc . You can backup /tmp , but it's pointless.
But, you'd be much better of just creating a post-install shell script to recover from a crash with maybe a /etc tarball.
Jeremy Falcon
|
|
|
|
|
Installed a second NAS-class disk in my home server, replacing a motley assortment of consumer grade drives, one of which died recently. RAID resync is almost complete
Another useful tip:
I set up a cron job to do a "dpkg -l" and a "snap list" to a user-space file, which is then included in my daily user backups.
So if I need to rebuild or replace a machine, I don't have to remember all the packages I've downloaded over time.
A quick file comparison tells me what I missed. (Meld is my weapon of choice, btw.)
As well as user space all over, I also back up /etc and /var from the server.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
|
It is pointless to start a discussion with "why would you want to do that ?"
But since you did and I have nothing better to do with MY TIME I give you a recent "event ".
My Ubuntu OS decided to quit "D_BUS message " installation...
OS load went into infinite loop trying to install
"D_BUS message "
The only solution was to "pull the plug".
I have been around the block few times and I know TECHNOLOGY FAILS.
It took me almost two weeks to recover and NO , I do not stare on monitor screen 24/7.
It is my hobby ONLY , the days of "gainful employment are gone " I am happily retired.
Cheers
PS I do not write scripts.
|
|
|
|
|
OK, when OS residing in RAID fails - does RAID copies the failed code into ALL partitions ?
How would that be of ANY help ?
|
|
|
|
|
I have an issue with 22.04.1 I like to resolve
I have two OS partitions dev/sde14 and dev/sde17
They both exhibit same failure during boot – “failed to (install) ..d bus” .
The boot process will try to activate d bus indefinitely and each time it suggest to check x file for details.
Since it never finishes ( the boot process) I cannot check this file.
Is there a way to resolve this ?
I mean reactivate the “d bus” to actually load .
Abandoning the OS partitions and installing an new OS IS NOT AN OPTION.
I have an investment in C++ IDE , on same partitions , and C++ code I like to keep – it resides in RAID5 in DIFFERENT partitions , NOT on dev/sde14 or dev/sde17.
modified 6-Nov-22 11:12am.
|
|
|
|
|
Reboot in single user mode. Get your files backed up. If that doesn't work, take the drive out of the system and get the files off it from a new system.
If it's corrupt, that sucks. Take it data recovery if you don't have backups.
Check fdisk , check fstab , or reinstall. Try not to bork your system again.
Jeremy Falcon
|
|
|
|
|
No good - I have RAID5 where I keep my C++ code, activating on ONE disk is an invite to RAID complications.
It failed SAME way on TWO partitions with same version of Ubuntu.
I am a sole ( and sore ) user of OS.
It is not data failure my data RAID5 is still OK - - nothing to recover when OS does not boot.
I have deleted BOTH failing OS partitions, installed NEW latest version of Ubuntu and having NEW issues
with it....
life is good...
Cheers
|
|
|
|
|
Hi,
I would like to ask the user to enter a command that will be executed, but I don't understand why I can't assign two commands to the same variable.
Here is the code:
user@localhost:~# read -ep "command: " cmd ; "$cmd"
And result:
command: id ; date
-bash: id ; date : command not found
but if I type a single command, it works.
Thanks for your help
|
|
|
|