Data Monitoring during IOS Network Program Development

Source: Internet
Author: User

Data Monitoring during IOS Network Program Development

When developing network programs, we can intuitively see the data exchange, which is very convenient for development. Here we provide several methods:

1. virtual Network Card 1. Create an RVI (remote virtual interface) virtual network card on the iPhone or iPad

Connect the device to the mac using usb. Open the command line tool and enter the command:

 

rvictl -s abcdef01234563e91f1f2f8a8cb0841d2dafeebbc
The long string is the device's UDID. You can use iTunes to query this item. (The serial number is displayed by default. Click the serial number to display it ). Click Edit> copy udid.

 

Normally, it will prompt that the Starting device *********************** [SUCCEDDED] with interface rival is successful.

Run the ifconfig-l command to test the function:

2. Use the tcpdump command to save the data packet to the. pcap file.

Enter the following command on the terminal:

 

sudo tcpdump -i rv0 -n -s 0 -w dumpFile.pcap tcp
Parameter description:

 

 

-I rv0 intercepts the data of the virtual network card-n does not use dns-s 0 to intercept the entire data packet, rather than the first byte-w dumpFile. pcp output file, which is the libpcap file format. tcp only intercepts tcp packets.

 

Run the app on the device and exit tcpdump at the end. If you do not need to intercept data, you can also remove the virtual network card.

 

rvictl -x abcdef01234563e91f1f2f8a8cb0841d2dafeebbc

 

But now this data file is not easy to use. If you open it with vim, it will be garbled.

Install a tcpreplay Tool

 

brew install tcpreplay
During the operation, I encountered this error:

 

 

Error: Cannot write to/usr/local/Cellar


Run the following command first:

Sudo chown-R $ USER/usr/local

After installation, run the following command:

 

tcprewrite --dlt=enet --enet-dmac=00:11:22:33:44:55 --enet-smac=66:77:88:99:AA:BB --infile=dumpFile.pcap --outfile=dumpFileFinal.pcap

 

3. Install wireshark to view Data

Download and install Wireshark.

Wireshark requires x11 support. If Wireshark is not installed, the installation will be guided when Wireshark is started. You can also download and install it here:

Http://xquartz.macosforge.org/landing/

When wireshark is started, the Choose Application may be prompted. Click Browser to/Application/Utilities/XQuartz. app. If you install the latest Wireshark, you may not need to specify it. It will automatically identify it.

Note that it may be slow to start opening, so be patient.

 

Open the converted dumpFileFinal. pcap to view the data content.

2. http data monitoring view HTTPArchive URL: http://www.softwareishard.com/blog/har-12-spec/
The pcap obtained using tcpdump can also be converted to httpArchive for viewing. You need to use the python script tool of pcap2har.

This will be further introduced later.

 

Iii. use Instruments network profiling

Data cannot be monitored using virtual machines during testing. You need to connect to the physical machine for testing.

This is an example of the result:

It is not easy to see the real data here, but only the general communication conditions.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.